implementing #36 tooltip over players nickname and rating function (thx to drull for this patch)

This commit is contained in:
doitux
2011-01-31 23:53:52 +00:00
parent e55e39a979
commit ca25c35b94
10 changed files with 1212 additions and 27 deletions
@@ -4,8 +4,8 @@
<StyleDescription value="danuxi table design" />
<StyleMaintainerName value="Daniel Hammer" />
<StyleMaintainerEMail value="webmaster@pokerth.net" />
<StyleCreateDate value="08.07.2010" />
<PokerTHStyleFileVersion value="2" />
<StyleCreateDate value="31.01.2011" />
<PokerTHStyleFileVersion value="3" />
<Preview value="preview.png" />
<IfFixedWindowSize value="1" />
<FixedWindowWidth value="1024" />
@@ -125,6 +125,8 @@
<BetSpeedSliderHandleBgColor value="A1B4FF" />
<BetSpeedSliderHandleBorderColor value="00177D" />
<ShowMyCardsButtonTextColor value="F0F0F0" />
<RatingStarsColor value="FFD700" />
<PlayerInfoHintTextColor value="FFFF00" />
<ChatLogTextSize value="11" />
</TableStyle>
</PokerTH>
@@ -4,8 +4,8 @@
<StyleDescription value="PokerTH default table style" /><!-- This string will be shown in settings/game table style list -->
<StyleMaintainerName value="PokerTH Development Team" /> <!-- This string should contain the name of the style maintainer and will be shown in style information -->
<StyleMaintainerEMail value="webmaster@pokerth.net" /> <!-- This string should contain the email address of the style maintainer and will be shown in style information and also in error message if there is a problem with the style. If you dont like to post your mail address here please write value="NULL". -->
<StyleCreateDate value="08.07.2010" /> <!-- This string should contain the create date or last date of modification and will be shown in style information-->
<PokerTHStyleFileVersion value="2" /> <!-- This number matches the current PokerTH internal version that is supported, you should not change it unless PokerTH tells you to update the style -->
<StyleCreateDate value="31.01.2011" /> <!-- This string should contain the create date or last date of modification and will be shown in style information-->
<PokerTHStyleFileVersion value="3" /> <!-- This number matches the current PokerTH internal version that is supported, you should not change it unless PokerTH tells you to update the style -->
<Preview value="preview.png" /> <!-- This preview picture will be shown in settings/game table style if this style is selected. The value should contain a filename of the preview picture which have to be stored in the same folder as this xml file. -->
<!-- Windows Settings -->
@@ -135,7 +135,9 @@
<BetSpeedSliderHandleBgColor value="99D500" />
<BetSpeedSliderHandleBorderColor value="286400" />
<ShowMyCardsButtonTextColor value="F0F0F0" />
<RatingStarsColor value="FFD700" />
<PlayerInfoHintTextColor value="FFFF00" />
<!-- Table Font Sizes - values should be set in px -->
<ChatLogTextSize value="11" />
</TableStyle>
+2 -1
View File
@@ -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, ""));
+861 -11
View File
File diff suppressed because it is too large Load Diff
+93 -4
View File
@@ -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<Game> currentGame = myStartWindow->getSession()->getCurrentGame();
boost::shared_ptr<Game> 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; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
@@ -2852,6 +2938,7 @@ void gameTableImpl::networkGameModification() {
tabWidget_Left->insertTab(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);
+4
View File
@@ -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;
};
+212 -2
View File
@@ -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<Game> currentGame = myW->myStartWindow->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
PlayerList seatsList = currentGame->getSeatsList();
std::list<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string> result;
std::string separator="(!#$%)";
std::list<std::string>::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<Game> 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("<a style='color: yellow;' href='"+QString::fromUtf8((*it_c)->getMyName().c_str())+"\""+QString::number(i)+"'>&#9734;</a>");
}
for(int i=1;i<=playerStars;i++)
{
myW->playerStarsArray[i][seatPlace]->setText("<a style='color: #"+myW->getMyGameTableStyle()->getRatingStarsColor()+";' href='"+QString::fromUtf8((*it_c)->getMyName().c_str())+"\""+QString::number(i)+"'>&#9733;</a>");
}
}
}
}
void MyAvatarLabel::refreshTooltips() {
boost::shared_ptr<Game> 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("<a style='text-decoration: none; color: #"+myW->getMyGameTableStyle()->getPlayerInfoHintTextColor()+"; font-size: 14px; font-weight: bold; font-family:serif;' href=\'")+QString::fromUtf8((*it_c)->getMyName().c_str())+"\'>i</a>");
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<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string>::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<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string>::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<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string> result;
std::list<std::string>::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<Game> 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++;
}
}
+11 -2
View File
@@ -13,11 +13,12 @@
#define MYAVATARLABEL_H
#include <iostream>
#include "startwindowimpl.h"
#include <QtGui>
#include <QtCore>
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;
@@ -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+"; }");
+7 -2
View File
@@ -29,7 +29,7 @@
#include <QtCore>
#include <QtGui>
#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;