From ca25c35b946d7b6db3fa6964453a11a509f2737f Mon Sep 17 00:00:00 2001 From: doitux Date: Mon, 31 Jan 2011 23:53:52 +0000 Subject: [PATCH] implementing #36 tooltip over players nickname and rating function (thx to drull for this patch) --- .../gui/table/danuxi1/danuxi1tablestyle.xml | 6 +- .../gui/table/default/defaulttablestyle.xml | 8 +- src/config/configfile.cpp | 3 +- src/gui/qt/gametable.ui | 872 +++++++++++++++++- src/gui/qt/gametable/gametableimpl.cpp | 97 +- src/gui/qt/gametable/gametableimpl.h | 4 + src/gui/qt/gametable/myavatarlabel.cpp | 214 ++++- src/gui/qt/gametable/myavatarlabel.h | 13 +- src/gui/qt/styles/gametablestylereader.cpp | 13 + src/gui/qt/styles/gametablestylereader.h | 9 +- 10 files changed, 1212 insertions(+), 27 deletions(-) diff --git a/data/gfx/gui/table/danuxi1/danuxi1tablestyle.xml b/data/gfx/gui/table/danuxi1/danuxi1tablestyle.xml index 65772dd0..61c0d6f9 100644 --- a/data/gfx/gui/table/danuxi1/danuxi1tablestyle.xml +++ b/data/gfx/gui/table/danuxi1/danuxi1tablestyle.xml @@ -4,8 +4,8 @@ - - + + @@ -125,6 +125,8 @@ + + diff --git a/data/gfx/gui/table/default/defaulttablestyle.xml b/data/gfx/gui/table/default/defaulttablestyle.xml index fca7eb3f..e3af147d 100644 --- a/data/gfx/gui/table/default/defaulttablestyle.xml +++ b/data/gfx/gui/table/default/defaulttablestyle.xml @@ -4,8 +4,8 @@ - - + + @@ -135,7 +135,9 @@ - + + + diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index 5bc0d6de..a7401980 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -50,7 +50,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) myConfigState = OK; // !!!! Revisionsnummer der Configdefaults !!!!! - configRev = 90; + configRev = 91; //standard defaults logOnOffDefault = "1"; @@ -152,6 +152,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) configList.push_back(ConfigInfo("GameTableStylesList", CONFIG_TYPE_STRING_LIST, "GameTableStyles")); configList.push_back(ConfigInfo("CurrentGameTableStyle", CONFIG_TYPE_STRING, "")); configList.push_back(ConfigInfo("CardDeckStylesList", CONFIG_TYPE_STRING_LIST, "CardDeckStyles")); + configList.push_back(ConfigInfo("PlayerTooltips", CONFIG_TYPE_STRING_LIST, "PlayerTooltips")); configList.push_back(ConfigInfo("CurrentCardDeckStyle", CONFIG_TYPE_STRING, "")); configList.push_back(ConfigInfo("LastGameTableStyleDir", CONFIG_TYPE_STRING, "")); configList.push_back(ConfigInfo("LastCardDeckStyleDir", CONFIG_TYPE_STRING, "")); diff --git a/src/gui/qt/gametable.ui b/src/gui/qt/gametable.ui index b1090289..8b3d8609 100644 --- a/src/gui/qt/gametable.ui +++ b/src/gui/qt/gametable.ui @@ -263,7 +263,7 @@ 12 - 68 + 75 52 10 @@ -272,6 +272,88 @@ + + + + 70 + 50 + 16 + 17 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ffffff;">*</span></p></body></html> + + + + + + 33 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 23 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 53 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 43 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 13 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + @@ -484,7 +566,7 @@ 12 - 62 + 57 52 10 @@ -493,6 +575,88 @@ + + + + 70 + 79 + 16 + 17 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ffffff;">*</span></p></body></html> + + + + + + 13 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 23 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 33 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 43 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 53 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + @@ -715,7 +879,7 @@ 12 - 68 + 75 52 10 @@ -724,6 +888,88 @@ + + + + 70 + 50 + 16 + 17 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ffffff;">*</span></p></body></html> + + + + + + 33 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 23 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 53 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 43 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 13 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + @@ -923,7 +1169,7 @@ 12 - 68 + 75 52 10 @@ -932,6 +1178,88 @@ + + + + 70 + 50 + 16 + 17 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ffffff;">*</span></p></body></html> + + + + + + 33 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 23 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 53 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 43 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 13 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + @@ -1131,7 +1459,7 @@ 12 - 68 + 75 52 10 @@ -1140,6 +1468,88 @@ + + + + 70 + 50 + 16 + 17 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ffffff;">*</span></p></body></html> + + + + + + 33 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 23 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 53 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 43 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 13 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + @@ -1359,7 +1769,7 @@ 12 - 68 + 75 52 10 @@ -1368,6 +1778,88 @@ + + + + 70 + 50 + 16 + 17 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ffffff;">*</span></p></body></html> + + + + + + 33 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 23 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 53 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 43 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 13 + 62 + 12 + 12 + + + + <a>&#9734;</a> + + @@ -1580,7 +2072,7 @@ 12 - 62 + 57 52 10 @@ -1589,6 +2081,88 @@ + + + + 70 + 79 + 16 + 17 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ffffff;">*</span></p></body></html> + + + + + + 33 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 23 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 53 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 43 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 13 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + @@ -2263,7 +2837,7 @@ 12 - 62 + 57 52 10 @@ -2272,6 +2846,88 @@ + + + + 70 + 79 + 16 + 17 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ffffff;">*</span></p></body></html> + + + + + + 33 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 23 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 53 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 43 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 13 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + @@ -2471,7 +3127,7 @@ 12 - 62 + 64 52 10 @@ -2493,6 +3149,88 @@ Show! + + + + 70 + 79 + 16 + 17 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ffffff;">*</span></p></body></html> + + + + + + 33 + 67 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 23 + 67 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 53 + 67 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 43 + 67 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 13 + 67 + 12 + 12 + + + + <a>&#9734;</a> + + @@ -2692,7 +3430,7 @@ 12 - 62 + 57 52 10 @@ -2701,6 +3439,88 @@ + + + + 70 + 79 + 16 + 17 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ffffff;">*</span></p></body></html> + + + + + + 33 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 23 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 53 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 43 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + + + + + 13 + 65 + 12 + 12 + + + + <a>&#9734;</a> + + @@ -2771,7 +3591,7 @@ Qt::NoFocus - 0 + 3 @@ -2962,6 +3782,36 @@ + + + Players tip + + + + 3 + + + 6 + + + + + Qt::ClickFocus + + + + + + + Qt::NoFocus + + + Save + + + + + diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 88c477d7..4cea9a28 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -199,6 +199,68 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) postRiverRunAnimation5Timer->setSingleShot(TRUE); postRiverRunAnimation6Timer->setSingleShot(TRUE); + + playerStarsArray[1][0]=label_Star10; + playerStarsArray[2][0]=label_Star20; + playerStarsArray[3][0]=label_Star30; + playerStarsArray[4][0]=label_Star40; + playerStarsArray[5][0]=label_Star50; + playerStarsArray[1][1]=label_Star11; + playerStarsArray[2][1]=label_Star21; + playerStarsArray[3][1]=label_Star31; + playerStarsArray[4][1]=label_Star41; + playerStarsArray[5][1]=label_Star51; + playerStarsArray[1][2]=label_Star12; + playerStarsArray[2][2]=label_Star22; + playerStarsArray[3][2]=label_Star32; + playerStarsArray[4][2]=label_Star42; + playerStarsArray[5][2]=label_Star52; + playerStarsArray[1][3]=label_Star13; + playerStarsArray[2][3]=label_Star23; + playerStarsArray[3][3]=label_Star33; + playerStarsArray[4][3]=label_Star43; + playerStarsArray[5][3]=label_Star53; + playerStarsArray[1][4]=label_Star14; + playerStarsArray[2][4]=label_Star24; + playerStarsArray[3][4]=label_Star34; + playerStarsArray[4][4]=label_Star44; + playerStarsArray[5][4]=label_Star54; + playerStarsArray[1][5]=label_Star15; + playerStarsArray[2][5]=label_Star25; + playerStarsArray[3][5]=label_Star35; + playerStarsArray[4][5]=label_Star45; + playerStarsArray[5][5]=label_Star55; + playerStarsArray[1][6]=label_Star16; + playerStarsArray[2][6]=label_Star26; + playerStarsArray[3][6]=label_Star36; + playerStarsArray[4][6]=label_Star46; + playerStarsArray[5][6]=label_Star56; + playerStarsArray[1][7]=label_Star17; + playerStarsArray[2][7]=label_Star27; + playerStarsArray[3][7]=label_Star37; + playerStarsArray[4][7]=label_Star47; + playerStarsArray[5][7]=label_Star57; + playerStarsArray[1][8]=label_Star18; + playerStarsArray[2][8]=label_Star28; + playerStarsArray[3][8]=label_Star38; + playerStarsArray[4][8]=label_Star48; + playerStarsArray[5][8]=label_Star58; + playerStarsArray[1][9]=label_Star19; + playerStarsArray[2][9]=label_Star29; + playerStarsArray[3][9]=label_Star39; + playerStarsArray[4][9]=label_Star49; + playerStarsArray[5][9]=label_Star59; + + + + + + + + + + + // buttonLabelArray init buttonLabelArray[0] = textLabel_Button0; buttonLabelArray[1] = textLabel_Button1; @@ -223,6 +285,17 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) cashLabelArray[8] = textLabel_Cash8; cashLabelArray[9] = textLabel_Cash9; + playerTipLabelArray[0] = label_playerTip0; + playerTipLabelArray[1] = label_playerTip1; + playerTipLabelArray[2] = label_playerTip2; + playerTipLabelArray[3] = label_playerTip3; + playerTipLabelArray[4] = label_playerTip4; + playerTipLabelArray[5] = label_playerTip5; + playerTipLabelArray[6] = label_playerTip6; + playerTipLabelArray[7] = label_playerTip7; + playerTipLabelArray[8] = label_playerTip8; + playerTipLabelArray[9] = label_playerTip9; + // playerNameLabelArray init playerNameLabelArray[0] = label_PlayerName0; playerNameLabelArray[1] = label_PlayerName1; @@ -355,6 +428,8 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) tabWidget_Left->setTabText(0, " "+tabWidget_Left->tabText(0)+" "); tabWidget_Left->setTabText(1, " "+tabWidget_Left->tabText(1)+" "); tabWidget_Left->setTabText(2, " "+tabWidget_Left->tabText(2)+" "); + tabWidget_Left->setTabText(3, " "+tabWidget_Left->tabText(3)+" "); + #endif //resize stop-button depending on translation @@ -400,6 +475,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) //Connects + connect(pushButton_tipSave, SIGNAL( clicked(bool) ), playerAvatarLabelArray[0], SLOT ( setPlayerTip() ) ); connect(dealFlopCards0Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards1() )); connect(dealFlopCards1Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards2() )); connect(dealFlopCards2Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards3() )); @@ -467,7 +543,14 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) connect( pushButton_voteOnKickNo, SIGNAL( clicked() ), this, SLOT( voteOnKickNo() ) ); connect( pushButton_showMyCards, SIGNAL( clicked() ), this, SLOT( sendShowMyCardsSignal() ) ); - + for(i=0;i<=9;i++)connect( playerTipLabelArray[i], SIGNAL( linkActivated(QString) ), playerAvatarLabelArray[i], SLOT(startChangePlayerTip(QString) ) ); + for(i=0;i<=9;i++) + { + for(int j=1;j<=5;j++) + { + connect( playerStarsArray[j][i], SIGNAL( linkActivated(QString) ), playerAvatarLabelArray[i], SLOT(setPlayerRating(QString) ) ); + } + } //Nachrichten Thread-Save connect(this, SIGNAL(signalInitGui(int)), this, SLOT(initGui(int))); connect(this, SIGNAL(signalRefreshSet()), this, SLOT(refreshSet())); @@ -779,12 +862,12 @@ void gameTableImpl::refreshButton() { } } + void gameTableImpl::refreshPlayerName() { if(myStartWindow->getSession()->getCurrentGame()) { - boost::shared_ptr currentGame = myStartWindow->getSession()->getCurrentGame(); - + boost::shared_ptr currentGame = myStartWindow->getSession()->getCurrentGame(); PlayerListConstIterator it_c; PlayerList seatsList = currentGame->getSeatsList(); for (it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++) { @@ -804,8 +887,8 @@ void gameTableImpl::refreshPlayerName() { bool guest = myStartWindow->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest; bool computerPlayer = false; if((*it_c)->getMyType() == PLAYER_TYPE_COMPUTER) { computerPlayer = true; } - playerNameLabelArray[(*it_c)->getMyID()]->setText(QString::fromUtf8((*it_c)->getMyName().c_str()), TRUE, guest, computerPlayer); + } else { @@ -818,6 +901,8 @@ void gameTableImpl::refreshPlayerName() { } } } + + playerAvatarLabelArray[0]->refreshTooltips(); } void gameTableImpl::refreshPlayerAvatar() { @@ -2821,6 +2906,7 @@ void gameTableImpl::localGameModification() { tabWidget_Left->setCurrentIndex(0); tabWidget_Left->removeTab(1); tabWidget_Left->removeTab(1); + tabWidget_Left->removeTab(1); int i; for (i=0; iinsertTab(1, tab_Chat, QString(tr("Chat"))); /*TODO text abgeschnitten --> stylesheets*/ tabWidget_Left->removeTab(2); + tabWidget_Left->removeTab(2); tabWidget_Left->setCurrentIndex(1); myChat->clearChat(); @@ -3272,6 +3359,7 @@ void gameTableImpl::refreshGameTableStyle() myGameTableStyle->setWindowsGeometry(this); myGameTableStyle->setChatLogStyle(textBrowser_Log); myGameTableStyle->setChatLogStyle(textBrowser_Chat); + myGameTableStyle->setChatLogStyle(textEdit_tipInput); myGameTableStyle->setChatInputStyle(lineEdit_ChatInput); int i; @@ -3300,6 +3388,7 @@ void gameTableImpl::refreshGameTableStyle() myGameTableStyle->setTableBackground(this); myGameTableStyle->setMenuBarStyle(menubar); myGameTableStyle->setBreakButtonStyle(pushButton_break,0); + myGameTableStyle->setBreakButtonStyle(pushButton_tipSave,0); myGameTableStyle->setSpeedStringStyle(label_speedString); myGameTableStyle->setSpeedStringStyle(label_speedValue); myGameTableStyle->setVoteButtonStyle(pushButton_voteOnKickYes); diff --git a/src/gui/qt/gametable/gametableimpl.h b/src/gui/qt/gametable/gametableimpl.h index 3cb8c565..f952bea3 100755 --- a/src/gui/qt/gametable/gametableimpl.h +++ b/src/gui/qt/gametable/gametableimpl.h @@ -71,6 +71,7 @@ public: void setSpeeds(); + signals: void signalInitGui(int speed); @@ -367,11 +368,13 @@ private: MyNameLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS]; MyAvatarLabel *playerAvatarLabelArray[MAX_NUMBER_OF_PLAYERS]; MyTimeoutLabel *timeoutLabelArray[MAX_NUMBER_OF_PLAYERS]; + QLabel *playerStarsArray[6][MAX_NUMBER_OF_PLAYERS]; QGroupBox *groupBoxArray[MAX_NUMBER_OF_PLAYERS]; MyCardsPixmapLabel *boardCardsArray[5]; MyCardsPixmapLabel *holeCardsArray[MAX_NUMBER_OF_PLAYERS][2]; + QLabel *playerTipLabelArray[MAX_NUMBER_OF_PLAYERS]; QPixmap flipside; // Dialogs @@ -447,6 +450,7 @@ private: QString TurnString; QString RiverString; + friend class MyAvatarLabel; friend class GuiWrapper; }; diff --git a/src/gui/qt/gametable/myavatarlabel.cpp b/src/gui/qt/gametable/myavatarlabel.cpp index 8fe59173..33a8a124 100644 --- a/src/gui/qt/gametable/myavatarlabel.cpp +++ b/src/gui/qt/gametable/myavatarlabel.cpp @@ -12,6 +12,7 @@ #include "myavatarlabel.h" #include "gametableimpl.h" +#include "gametablestylereader.h" #include "session.h" #include "playerinterface.h" #include "game.h" @@ -25,6 +26,8 @@ MyAvatarLabel::MyAvatarLabel(QGroupBox* parent) { myContextMenu = new QMenu; + action_EditTip = new QAction(QIcon(), tr("Add/Edit/Remove tooltip"), myContextMenu); + myContextMenu->addAction(action_EditTip); action_VoteForKick = new QAction(QIcon(":/gfx/list_remove_user.png"), tr("Start vote to kick this player"), myContextMenu); myContextMenu->addAction(action_VoteForKick); action_IgnorePlayer = new QAction(QIcon(":/gfx/im-ban-user.png"), tr("Ignore Player"), myContextMenu); @@ -36,6 +39,7 @@ MyAvatarLabel::MyAvatarLabel(QGroupBox* parent) connect( action_VoteForKick, SIGNAL ( triggered() ), this, SLOT ( sendTriggerVoteOnKickSignal() ) ); connect( action_IgnorePlayer, SIGNAL ( triggered() ), this, SLOT ( putPlayerOnIgnoreList() ) ); connect( action_ReportBadAvatar, SIGNAL ( triggered() ), this, SLOT ( reportBadAvatar() ) ); + connect( action_EditTip, SIGNAL( triggered() ), this, SLOT ( startEditTip() ) ); } @@ -69,14 +73,23 @@ void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) { } action_IgnorePlayer->setEnabled(true); - + action_EditTip->setEnabled(true); int j=0; for (it_c=seatList->begin(); it_c!=seatList->end(); it_c++) { if(myId == j) { - + if(j == 0) + { + action_EditTip->setDisabled(true); + } + if(myW->myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) + { + action_EditTip->setDisabled(true); + } + if(myW->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest) { action_IgnorePlayer->setDisabled(true); + action_EditTip->setDisabled(true); } if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET && !((*it_c)->getMyAvatar().empty()) ) { @@ -107,6 +120,187 @@ void MyAvatarLabel::showContextMenu(const QPoint &pos) { myContextMenu->popup(pos); } +void MyAvatarLabel::setPlayerRating(QString playerInfo) +{ +int found=0; +QStringList playerInfoList=playerInfo.split("\"", QString::KeepEmptyParts, Qt::CaseSensitive), tipInfo; +boost::shared_ptr currentGame = myW->myStartWindow->getSession()->getCurrentGame(); +PlayerListConstIterator it_c; +PlayerList seatsList = currentGame->getSeatsList(); +std::list tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips"); +std::list result; +std::string separator="(!#$%)"; +std::list::iterator iterator; +for(iterator = tipsList.begin(); iterator != tipsList.end();iterator++) { + tipInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive); + if(tipInfo.at(0)==playerInfoList.at(0)) + { + result.push_back(tipInfo.at(0).toUtf8().constData()+separator+tipInfo.at(1).toUtf8().constData()+separator+playerInfoList.at(1).toUtf8().constData()+separator); + found=1; + } + else + { + result.push_back(tipInfo.at(0).toUtf8().constData()+separator+tipInfo.at(1).toUtf8().constData()+separator+tipInfo.at(2).toUtf8().constData()+separator); + } +} +if(found==0) + { + result.push_back(playerInfoList.at(0).toUtf8().constData()+separator+separator+playerInfoList.at(1).toUtf8().constData()+separator); + } +myW->getMyConfig()->writeConfigStringList("PlayerTooltips", result); +myW->getMyConfig()->writeBuffer(); +refreshStars(); +} + + +void MyAvatarLabel::startChangePlayerTip(QString playerName) +{ + if(myW->tabWidget_Left->widget(2) == myW->tab_Kick) + { + myW->tabWidget_Left->insertTab(3, myW->tab_editTip, playerName); + myW->tabWidget_Left->setCurrentIndex(3); + } + else + { + myW->tabWidget_Left->insertTab(2, myW->tab_editTip, playerName); + myW->tabWidget_Left->setCurrentIndex(2); + } +myW->textEdit_tipInput->setPlainText(getPlayerTip(playerName)); +} + +void MyAvatarLabel::refreshStars() +{ +boost::shared_ptr curGame = myW->myStartWindow->getSession()->getCurrentGame(); +PlayerListConstIterator it_c; +int seatPlace; +PlayerList seatsList = curGame->getSeatsList(); +for (seatPlace=0,it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++, seatPlace++) { + for(int i=1;i<=5;i++)myW->playerStarsArray[i][seatPlace]->setText(""); + if(myW->myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET && !myW->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER) + if((*it_c)->getMyStayOnTableStatus() == TRUE && (*it_c)->getMyName()!="" && seatPlace!=0) { + int playerStars=getPlayerRating(QString::fromUtf8((*it_c)->getMyName().c_str())); + for(int i=1;i<=5;i++) + { + myW->playerStarsArray[i][seatPlace]->setText(""); + } + for(int i=1;i<=playerStars;i++) + { + myW->playerStarsArray[i][seatPlace]->setText(""); + } + + } +} +} + +void MyAvatarLabel::refreshTooltips() { + boost::shared_ptr currentGame = myW->myStartWindow->getSession()->getCurrentGame(); + PlayerListConstIterator it_c; + int seatPlace; + PlayerList seatsList = currentGame->getSeatsList(); + for (seatPlace=0,it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++, seatPlace++) { + if((*it_c)->getMyStayOnTableStatus() == TRUE || (*it_c)->getMyActiveStatus()) { + bool computerPlayer = false; + if((*it_c)->getMyType() == PLAYER_TYPE_COMPUTER) { computerPlayer = true; } + if(!computerPlayer && getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str()))!="") + { + myW->playerTipLabelArray[(*it_c)->getMyID()]->setText(QString("getMyName().c_str())+"\'>i"); + myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip( getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str())) ); + myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip( getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str())) ); + } + else + { + myW->playerTipLabelArray[(*it_c)->getMyID()]->setText(""); + myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip(""); + myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip(""); + } + } + else + { + myW->playerTipLabelArray[(*it_c)->getMyID()]->setText(""); + myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip(""); + myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip(""); + + } + + + } +refreshStars(); +} + +int MyAvatarLabel::getPlayerRating(QString playerName) +{ +std::list tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips"); +std::list::iterator iterator; +QStringList playerInfo; +QString result="0"; +for(iterator = tipsList.begin(); iterator != tipsList.end(); iterator++) { + playerInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive); + if(playerInfo.at(0)==playerName) + { + result=playerInfo.at(2); + break; + } + } +return result.toInt(); +} + + +QString MyAvatarLabel::getPlayerTip(QString playerName) +{ +std::list tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips"); +std::list::iterator iterator; +QStringList playerInfo; +for(iterator = tipsList.begin(); iterator != tipsList.end(); iterator++) { + playerInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive); + if(playerInfo.at(0)==playerName)return playerInfo.at(1); + } +return QString(""); +} + + +void MyAvatarLabel::setPlayerTip() +{ +int found=0; +std::string rating="1", separator="(!#$%)"; +std::string tip = std::string((const char*)myW->textEdit_tipInput->toPlainText().toUtf8()); +std::string playerName; +if(myW->tabWidget_Left->widget(2) == myW->tab_editTip)playerName = myW->tabWidget_Left->tabText(2).toUtf8().constData(); +if(myW->tabWidget_Left->widget(3) == myW->tab_editTip)playerName = myW->tabWidget_Left->tabText(3).toUtf8().constData(); +QStringList playerInfo; +std::list tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips"); +std::list result; +std::list::iterator iterator; +for(iterator = tipsList.begin(); iterator != tipsList.end();iterator++) { + playerInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive); + if(QString::fromUtf8(playerName.c_str())==playerInfo.at(0)) + { + result.push_back(playerName+separator+QString::fromUtf8(tip.c_str()).toUtf8().constData()+separator+playerInfo.at(2).toStdString()+separator); + found=1; + } + else + { + result.push_back(playerInfo.at(0).toUtf8().constData()+separator+playerInfo.at(1).toUtf8().constData()+separator+playerInfo.at(2).toStdString()+separator); + } +} +if(found==0) + { + result.push_back(playerName.c_str()+separator+QString::fromUtf8(tip.c_str()).toUtf8().constData()+separator+QString("0").toStdString()+separator); + } +myW->getMyConfig()->writeConfigStringList("PlayerTooltips", result); +myW->getMyConfig()->writeBuffer(); + +if(myW->tabWidget_Left->widget(3) == myW->tab_editTip) + { + myW->tabWidget_Left->removeTab(3); + } + else if(myW->tabWidget_Left->widget(2) == myW->tab_editTip) + { + myW->tabWidget_Left->removeTab(2); + } +refreshTooltips(); +} + + void MyAvatarLabel::sendTriggerVoteOnKickSignal() { myW->triggerVoteOnKick(myId); @@ -229,3 +423,19 @@ void MyAvatarLabel::reportBadAvatar() { j++; } } + + +void MyAvatarLabel::startEditTip() { + boost::shared_ptr currentGame = myW->getSession()->getCurrentGame(); + int j=0; + PlayerListConstIterator it_c; + PlayerList seatList = currentGame->getSeatsList(); + for (it_c=seatList->begin(); it_c!=seatList->end(); it_c++) { + if(myId == j) { + QString nick = QString::fromUtf8((*it_c)->getMyName().c_str()); + startChangePlayerTip(nick); + break; + } + j++; + } +} diff --git a/src/gui/qt/gametable/myavatarlabel.h b/src/gui/qt/gametable/myavatarlabel.h index f4e37cee..643d7170 100644 --- a/src/gui/qt/gametable/myavatarlabel.h +++ b/src/gui/qt/gametable/myavatarlabel.h @@ -13,11 +13,12 @@ #define MYAVATARLABEL_H #include - +#include "startwindowimpl.h" #include #include class gameTableImpl; +class startWindowImpl; class MyAvatarLabel : public QLabel { @@ -29,6 +30,8 @@ public: void setMyW(gameTableImpl* theValue) { myW = theValue; } void setMyId ( int theValue ) { myId = theValue; } void contextMenuEvent ( QContextMenuEvent * event ); + QString getPlayerTip(QString); + int getPlayerRating(QString); public slots: @@ -44,7 +47,12 @@ public slots: void putPlayerOnIgnoreList(); bool playerIsOnIgnoreList(QString playerName); void reportBadAvatar(); - + void startEditTip(); + void startChangePlayerTip(QString playerName); + void setPlayerTip(); + void setPlayerRating(QString); + void refreshTooltips(); + void refreshStars(); private: gameTableImpl *myW; @@ -52,6 +60,7 @@ private: QAction *action_VoteForKick; QAction *action_IgnorePlayer; QAction *action_ReportBadAvatar; + QAction *action_EditTip; QPixmap myPixmap; QString myPath; diff --git a/src/gui/qt/styles/gametablestylereader.cpp b/src/gui/qt/styles/gametablestylereader.cpp index d29d334d..1e0b4ce9 100644 --- a/src/gui/qt/styles/gametablestylereader.cpp +++ b/src/gui/qt/styles/gametablestylereader.cpp @@ -229,6 +229,8 @@ void GameTableStyleReader::readStyleFile(QString file) { BetSpeedSliderHandleBgColor.clear(); BetSpeedSliderHandleBorderColor.clear(); ShowMyCardsButtonTextColor.clear(); + RatingStarsColor.clear(); + PlayerInfoHintTextColor.clear(); ChatLogTextSize.clear(); //now reading! @@ -369,6 +371,8 @@ void GameTableStyleReader::readStyleFile(QString file) { else if (itemsList->ValueStr() == "BetSpeedSliderHandleBgColor") { BetSpeedSliderHandleBgColor = QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "BetSpeedSliderHandleBorderColor") { BetSpeedSliderHandleBorderColor = QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "ShowMyCardsButtonTextColor") { ShowMyCardsButtonTextColor = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "RatingStarsColor") { RatingStarsColor = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "PlayerInfoHintTextColor") { PlayerInfoHintTextColor = QString::fromUtf8(tempString1.c_str()); } // SIZES else if (itemsList->ValueStr() == "ChatLogTextSize") { ChatLogTextSize = QString::fromUtf8(tempString1.c_str()); } } @@ -599,6 +603,8 @@ void GameTableStyleReader::readStyleFile(QString file) { if(BetSpeedSliderHandleBgColor == "") { BetSpeedSliderHandleBgColor = getFallBackFieldContent("BetSpeedSliderHandleBgColor", 0); leftItems << "BetSpeedSliderHandleBgColor"; } if(BetSpeedSliderHandleBorderColor == "") { BetSpeedSliderHandleBorderColor = getFallBackFieldContent("BetSpeedSliderHandleBorderColor", 0); leftItems << "BetSpeedSliderHandleBorderColor"; } if(ShowMyCardsButtonTextColor == "") { ShowMyCardsButtonTextColor = getFallBackFieldContent("ShowMyCardsButtonTextColor", 0); leftItems << "ShowMyCardsButtonTextColor"; } + if(RatingStarsColor == "") { RatingStarsColor = getFallBackFieldContent("RatingStarsColor", 0); leftItems << "RatingStarsColor"; } + if(PlayerInfoHintTextColor == "") { PlayerInfoHintTextColor = getFallBackFieldContent("PlayerInfoHintTextColor", 0); leftItems << "PlayerInfoHintTextColor"; } // SIZE if(ChatLogTextSize == "") { ChatLogTextSize = getFallBackFieldContent("ChatLogTextSize", 0); leftItems << "ChatLogTextSize"; } @@ -698,6 +704,13 @@ void GameTableStyleReader::setChatLogStyle(QTextBrowser *tb) } +void GameTableStyleReader::setChatLogStyle(QPlainTextEdit* pte) +{ + pte->setStyleSheet("QPlainTextEdit { "+ font1String +" font-size: "+ChatLogTextSize+"px; color: #"+ChatLogTextColor+"; background-color: #"+ChatLogBgColor+"; border:none; } QScrollBar:vertical { border: 1px solid #"+ChatLogScrollBarBorderColor+"; background: #"+ChatLogScrollBarBgColor+"; width: 15px; margin: 17px -1px 17px 0px; } QScrollBar::handle:vertical { border-radius: 1px; border: 1px solid #"+ChatLogScrollBarHandleBorderColor+"; background: #"+ChatLogScrollBarHandleBgColor+"; min-height: 20px; } QScrollBar::add-line:vertical { margin-right: 0px; margin-left: 1px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 1px; border-top-left-radius: 1px; border: 1px solid #"+ChatLogScrollBarHandleBorderColor+"; background: #"+ChatLogScrollBarHandleBgColor+"; height: 15px; subcontrol-position: bottom; subcontrol-origin: margin; } QScrollBar::sub-line:vertical { margin-right: 0px; margin-left: 1px; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px; border-top-right-radius: 2px; border-top-left-radius: 2px; border: 1px solid #"+ChatLogScrollBarHandleBorderColor+"; background: #"+ChatLogScrollBarHandleBgColor+"; height: 15px; subcontrol-position: top; subcontrol-origin: margin; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { border: 1px solid #"+ChatLogScrollBarArrowBorderColor+"; height: 3px; width: 3px; background: #"+ChatLogScrollBarArrowBgColor+"; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }"); + +} + + void GameTableStyleReader::setChatInputStyle(QLineEdit *ci) { ci->setStyleSheet("QLineEdit { "+ font1String +" font-size: "+ChatLogTextSize+"px; color: #"+ChatLogTextColor+"; background-color: #"+ChatLogBgColor+"; border-top: 2px solid #"+TabWidgetBorderColor+"; }"); diff --git a/src/gui/qt/styles/gametablestylereader.h b/src/gui/qt/styles/gametablestylereader.h index b6426a7c..e9780fe4 100644 --- a/src/gui/qt/styles/gametablestylereader.h +++ b/src/gui/qt/styles/gametablestylereader.h @@ -29,7 +29,7 @@ #include #include -#define POKERTH_GT_STYLE_FILE_VERSION 2 +#define POKERTH_GT_STYLE_FILE_VERSION 3 enum GtStyleState { GT_STYLE_OK = 0, @@ -77,7 +77,9 @@ public: QString getLogWinnerSidePotColor() const { return LogWinnerSidePotColor; } QString getLogPlayerSitsOutColor() const { return LogPlayerSitsOutColor; } QString getLogNewGameAdminColor() const { return LogNewGameAdminColor; } - QString getBreakLobbyButtonBgColor() const { return BreakLobbyButtonBgColor; } + QString getBreakLobbyButtonBgColor() const { return BreakLobbyButtonBgColor; } + QString getRatingStarsColor() const { return RatingStarsColor; } + QString getPlayerInfoHintTextColor() const { return PlayerInfoHintTextColor; } QString getPlayerNickTextColor() const { return PlayerNickTextColor; } QString getPlayerNameLabelFontSize() const { return playerNameLabelFontSize; } @@ -104,6 +106,7 @@ public: //set fonts + colors void setChatLogStyle(QTextBrowser*); + void setChatLogStyle(QPlainTextEdit*); void setChatInputStyle(QLineEdit*); void setCashLabelStyle(QLabel*); void setSetLabelStyle(QLabel*); @@ -279,6 +282,8 @@ private: QString BetSpeedSliderHandleBgColor; QString BetSpeedSliderHandleBorderColor; QString ShowMyCardsButtonTextColor; + QString RatingStarsColor; + QString PlayerInfoHintTextColor; // SIZES QString ChatLogTextSize;