From b944852a4e52dea944b413c0b137f82ec683de81 Mon Sep 17 00:00:00 2001 From: doitux Date: Wed, 1 Apr 2009 12:27:31 +0000 Subject: [PATCH] first colors and font sizes are skinnable now --- .../gui/table/default/defaulttablestyle.xml | 14 +- src/gui/qt/chattools/chattools.cpp | 9 +- src/gui/qt/chattools/chattools.h | 5 + src/gui/qt/gamelobbydialog.ui | 350 +++++++++--------- src/gui/qt/gametable/chat/chat.cpp | 6 + src/gui/qt/gametable/chat/chat.h | 2 + src/gui/qt/gametable/gametableimpl.cpp | 24 +- src/gui/qt/gametable/gametableimpl.h | 2 + src/gui/qt/gametable/log/log.cpp | 10 +- src/gui/qt/gametable/log/log.h | 4 +- src/gui/qt/gametable/myactionbutton.cpp | 4 +- src/gui/qt/gametable/myactionbutton.h | 5 + src/gui/qt/gametable/mychancelabel.cpp | 47 +-- src/gui/qt/gametable/mychancelabel.h | 3 + src/gui/qt/styles/gametablestylereader.cpp | 74 +++- src/gui/qt/styles/gametablestylereader.h | 38 +- 16 files changed, 355 insertions(+), 242 deletions(-) diff --git a/data/gfx/gui/table/default/defaulttablestyle.xml b/data/gfx/gui/table/default/defaulttablestyle.xml index c4c7dfd5..2fa1c02a 100644 --- a/data/gfx/gui/table/default/defaulttablestyle.xml +++ b/data/gfx/gui/table/default/defaulttablestyle.xml @@ -3,7 +3,6 @@ - @@ -11,6 +10,7 @@ + @@ -46,5 +46,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/gui/qt/chattools/chattools.cpp b/src/gui/qt/chattools/chattools.cpp index f69db69c..45c9fdf0 100644 --- a/src/gui/qt/chattools/chattools.cpp +++ b/src/gui/qt/chattools/chattools.cpp @@ -20,6 +20,7 @@ #include "chattools.h" #include "session.h" #include "configfile.h" +#include "gametablestylereader.h" #include using namespace std; @@ -63,9 +64,11 @@ void ChatTools::receiveMessage(QString playerName, QString message) { switch (myNotifyMode) { case 0: tempMsg = message; break; +// lobby case 1: tempMsg = QString(""+message+""); break; - case 2: tempMsg = QString(""+message+""); +// ingame + case 2: tempMsg = QString("getChatTextNickNotifyColor()+";\">"+message+""); break; default:; } @@ -74,9 +77,11 @@ void ChatTools::receiveMessage(QString playerName, QString message) { switch (myNotifyMode) { case 0: tempMsg = message; break; +// lobby case 1: tempMsg = QString(""+message+""); break; - case 2: tempMsg = QString(""+message+""); +// ingame + case 2: tempMsg = QString("getChatTextColor()+";\">"+message+""); break; default:; } diff --git a/src/gui/qt/chattools/chattools.h b/src/gui/qt/chattools/chattools.h index 479f54d1..dab2dff0 100644 --- a/src/gui/qt/chattools/chattools.h +++ b/src/gui/qt/chattools/chattools.h @@ -27,6 +27,7 @@ class Session; class ConfigFile; +class GameTableStyleReader; class ChatTools : public QObject { @@ -55,6 +56,8 @@ public slots: void setPlayerNicksList(QStringList value) { myNickStringList = value; } void setMyNick ( const QString& theValue ) { myNick = theValue; } + + void setMyStyle ( GameTableStyleReader* theValue ) { myStyle = theValue; } private: @@ -73,6 +76,8 @@ private: ConfigFile *myConfig; QString myNick; + + GameTableStyleReader *myStyle; }; #endif diff --git a/src/gui/qt/gamelobbydialog.ui b/src/gui/qt/gamelobbydialog.ui index 79013a32..65e39993 100644 --- a/src/gui/qt/gamelobbydialog.ui +++ b/src/gui/qt/gamelobbydialog.ui @@ -1,7 +1,8 @@ - + + gameLobbyDialog - - + + 0 0 @@ -9,172 +10,172 @@ 618 - - + + 0 0 - + 875 618 - + Internet Game Lobby - - + + 4 - + 4 - - - - + + + + 0 0 - + 165 0 - + 165 16777215 - + 5 - + false - + true - + Available Players - - - + + + 400 0 - + Qt::ScrollBarAlwaysOff - + true - + Game - + Players - + State - + Private - - - + + + false - - + + 0 0 - + 270 0 - + 270 16777215 - + Game Info - - - - + + + + 221 221 - + 1 - + 25 26 - + 15 - + Connected Players - - - + + + Fill up with computer opponents - - - + + + 6 - + Qt::Horizontal - + 40 20 @@ -183,174 +184,174 @@ - - + + Start Game - - + + Kick Player - - + + - - + + Maximum number of players: - - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - - + + Start Cash: - - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - - + + First small blind: - - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - - + + Blinds raise interval: - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing - - + + - - + + Blinds raise mode: - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - + + - + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing - + true - - + + - - + + Manual blinds list: - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - + + - + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing - + true - - + + - - + + Timeout for player action (sec): - - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + - + Qt::Vertical - + 248 91 @@ -358,20 +359,20 @@ - - - + + + 0 - + Qt::Vertical - + QSizePolicy::Fixed - + 0 27 @@ -380,14 +381,14 @@ - - - + + + 0 0 - + Leave Game @@ -397,39 +398,30 @@ - - - + + + 6 - - 0 - - - 0 - - - 0 - - + 0 - - + + Join any game - + Qt::Horizontal - + QSizePolicy::Expanding - + 181 20 @@ -439,13 +431,13 @@ - + Qt::Vertical - + QSizePolicy::Fixed - + 0 28 @@ -454,90 +446,92 @@ - - + + Create Game - - + + Join Game - - - + + + Lobby-Chat - - + + 7 - - 7 - - - 7 - - - 7 - - + 0 - - 0 - - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + 0 0 - + + + + + <!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:'Nimbus Sans L'; font-size:8pt; 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;"><a href="http://www.pokerth.net"><span style=" text-decoration: underline; color:#0000ff;">http://www.pokerth.net</span></a></p></body></html> + + + true + + + diff --git a/src/gui/qt/gametable/chat/chat.cpp b/src/gui/qt/gametable/chat/chat.cpp index e49c8037..e0df3757 100755 --- a/src/gui/qt/gametable/chat/chat.cpp +++ b/src/gui/qt/gametable/chat/chat.cpp @@ -25,6 +25,7 @@ #include "playerinterface.h" #include "chattools.h" #include "configfile.h" +#include "gametablestylereader.h" using namespace std; @@ -108,3 +109,8 @@ int Chat::getChatLinesHistorySize() { return myChatTools->getChatLinesHistorySiz void Chat::showChatHistoryIndex(int index) { myChatTools->showChatHistoryIndex(index); } void Chat::nickAutoCompletition() { myChatTools->nickAutoCompletition(); } void Chat::setChatTextEdited() { myChatTools->setChatTextEdited(); } + +void Chat::transportMyStyle(GameTableStyleReader *s) +{ + myChatTools->setMyStyle(s); +} diff --git a/src/gui/qt/gametable/chat/chat.h b/src/gui/qt/gametable/chat/chat.h index 9db8b41d..36b7a115 100755 --- a/src/gui/qt/gametable/chat/chat.h +++ b/src/gui/qt/gametable/chat/chat.h @@ -27,6 +27,7 @@ class gameTableImpl; class ChatTools; class ConfigFile; +class GameTableStyleReader; class Chat : public QObject { @@ -44,6 +45,7 @@ public slots: void checkInvisible(); void checkInputLength(QString); void clearNewGame(); + void transportMyStyle(GameTableStyleReader*); ChatTools* getMyChatTools() const { return myChatTools; } diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 098d5d0b..af33281b 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -87,6 +87,9 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) pixmapLabel_card0b->setMyW(this); pixmapLabel_card0a->setMyW(this); + //set myStyle to widgets wich needs it + label_chance->setMyStyle(myGameTableStyle); + //Flipside festlegen; if (myConfig->readConfigInt("FlipsideOwn") && myConfig->readConfigString("FlipsideOwnFile") != "") { flipside = new QPixmap(); @@ -365,6 +368,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) // Dialogs myChat = new Chat(this, myConfig); + myChat->transportMyStyle(myGameTableStyle); lineEdit_ChatInput->installEventFilter(this); this->installEventFilter(this); @@ -2408,7 +2412,7 @@ void gameTableImpl::nextRoundCleanGui() { //Clean breakbutton if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) { blinkingStartButtonAnimationTimer->stop(); - pushButton_break->setStyleSheet("QPushButton { background-color: #145300; color: #99D500;}"); + myGameTableStyle->setBreakButtonStyle(pushButton_break,0); blinkingStartButtonAnimationTimer->stop(); QFontMetrics tempMetrics = this->fontMetrics(); int width = tempMetrics.width(tr("Stop")); @@ -2494,7 +2498,7 @@ void gameTableImpl::breakButtonClicked() { blinkingStartButtonAnimationTimer->stop(); //Set default Color - pushButton_break->setStyleSheet("QPushButton { background-color: #145300; color: #99D500;}"); + myGameTableStyle->setBreakButtonStyle(pushButton_break,0); QFontMetrics tempMetrics = this->fontMetrics(); int width = tempMetrics.width(tr("Stop")); pushButton_break->setMinimumSize(width+10,20); @@ -2713,11 +2717,11 @@ void gameTableImpl::blinkingStartButtonAnimationAction() { QString style = pushButton_break->styleSheet(); - if(style.contains("QPushButton { background-color: #145300;")) { - pushButton_break->setStyleSheet("QPushButton { background-color: #6E9E00; color: black;}"); + if(style.contains("QPushButton:enabled { background-color: #145300;")) { + myGameTableStyle->setBreakButtonStyle(pushButton_break,1); } else { - pushButton_break->setStyleSheet("QPushButton { background-color: #145300; color: #99D500;}"); + myGameTableStyle->setBreakButtonStyle(pushButton_break,0); } } @@ -3164,13 +3168,6 @@ void gameTableImpl::refreshGameTableStyle() myGameTableStyle->setChatStyle(textBrowser_Chat); myGameTableStyle->setChatInputStyle(lineEdit_ChatInput); -#ifdef __APPLE__ -// tabWidget_Right->setStyleSheet("QTabWidget { "+ font1String +" font-size: 11px; background-color: #145300; }"); -// tabWidget_Left->setStyleSheet("QTabWidget { "+ font1String +" font-size: 11px; background-color: #145300;}"); -#else -// tabWidget_Right->setStyleSheet("QTabWidget::pane { "+ font1String +" font-size: 10px; background-color: #145300; border: 1px solid #286400; border-radius: 2px; }"); -// tabWidget_Left->setStyleSheet("QTabWidget::pane { border: 1px solid #286400; border-radius: 2px; background-color: #145300; }"); -#endif int i; for (i=0; isetCardHolderStyle(label_CardHolder4,2); myGameTableStyle->setTableBackground(this); myGameTableStyle->setMenuBarStyle(menubar); - myGameTableStyle->setBreakButtonStyle(pushButton_break); + myGameTableStyle->setBreakButtonStyle(pushButton_break,0); myGameTableStyle->setSpeedStringStyle(label_speedString); myGameTableStyle->setSpeedStringStyle(label_speedValue); myGameTableStyle->setVoteButtonStyle(pushButton_voteOnKickYes); @@ -3228,6 +3225,5 @@ void gameTableImpl::refreshGameTableStyle() myGameTableStyle->setTabWidgetStyle(tabWidget_Right, tabWidget_Right->getMyTabBar()); myGameTableStyle->setTabWidgetStyle(tabWidget_Left, tabWidget_Left->getMyTabBar()); - label_Handranking->setPixmap(myGameTableStyle->getHandRanking()); } diff --git a/src/gui/qt/gametable/gametableimpl.h b/src/gui/qt/gametable/gametableimpl.h index 18204518..0804a49e 100755 --- a/src/gui/qt/gametable/gametableimpl.h +++ b/src/gui/qt/gametable/gametableimpl.h @@ -64,6 +64,8 @@ public: SDLPlayer* getMySDLPlayer() const { return mySDLPlayer; } Chat* getMyChat() const { return myChat; } + + GameTableStyleReader* getMyGameTableStyle() const { return myGameTableStyle; } void setSpeeds(); diff --git a/src/gui/qt/gametable/log/log.cpp b/src/gui/qt/gametable/log/log.cpp index da8459f7..50ef0cda 100755 --- a/src/gui/qt/gametable/log/log.cpp +++ b/src/gui/qt/gametable/log/log.cpp @@ -24,12 +24,14 @@ #include #include #include +#include "gametablestylereader.h" using namespace std; Log::Log(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), myLogFile(0) { myW->setLog(this); + myStyle = myW->getMyGameTableStyle(); myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); @@ -207,9 +209,9 @@ void Log::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbNa void Log::logPlayerWinsMsg(QString playerName, int pot, bool main) { if(main) { - myW->textBrowser_Log->append(""+playerName+" wins $"+QString::number(pot,10)+""); + myW->textBrowser_Log->append("getLogWinnerMainPotColor()+";\">"+playerName+" wins $"+QString::number(pot,10)+""); } else { - myW->textBrowser_Log->append(""+playerName+" wins $"+QString::number(pot,10)+" (side pot)"); + myW->textBrowser_Log->append("getLogWinnerSidePotColor()+";\">"+playerName+" wins $"+QString::number(pot,10)+" (side pot)"); } if(myConfig->readConfigInt("LogOnOff")) { @@ -231,7 +233,7 @@ void Log::logPlayerWinsMsg(QString playerName, int pot, bool main) { void Log::logPlayerSitsOut(QString playerName) { - myW->textBrowser_Log->append(""+playerName+" sits out"); + myW->textBrowser_Log->append("getLogPlayerSitsOutColor()+";\">"+playerName+" sits out"); if(myConfig->readConfigInt("LogOnOff")) { @@ -344,7 +346,7 @@ void Log::logPlayerLeftMsg(QString playerName, int wasKicked) { void Log::logNewGameAdminMsg(QString playerName) { - myW->textBrowser_Log->append( ""+playerName+" is game admin now!"); + myW->textBrowser_Log->append( "getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!"); if(myConfig->readConfigInt("LogOnOff")) { diff --git a/src/gui/qt/gametable/log/log.h b/src/gui/qt/gametable/log/log.h index 058936df..10e973bd 100755 --- a/src/gui/qt/gametable/log/log.h +++ b/src/gui/qt/gametable/log/log.h @@ -28,7 +28,7 @@ #include class gameTableImpl; - +class GameTableStyleReader; class Log : public QObject { @@ -87,6 +87,8 @@ private: QString logFileStreamString; QString myAppDataPath; + GameTableStyleReader *myStyle; + friend class GuiWrapper; }; diff --git a/src/gui/qt/gametable/myactionbutton.cpp b/src/gui/qt/gametable/myactionbutton.cpp index 5f6d2237..0987ceb3 100644 --- a/src/gui/qt/gametable/myactionbutton.cpp +++ b/src/gui/qt/gametable/myactionbutton.cpp @@ -10,7 +10,7 @@ // // #include "myactionbutton.h" - +#include "gametablestylereader.h" using namespace std; @@ -30,7 +30,7 @@ void MyActionButton::paintEvent(QPaintEvent * event) { QPushButton::paintEvent(event); QPainter painter(this); - painter.setPen(QColor(240,240,240)); + painter.setPen(QColor("#"+myStyle->getFKeyIndicatorColor())); painter.setOpacity(0.5); QFont f= painter.font(); f.setPixelSize(9); diff --git a/src/gui/qt/gametable/myactionbutton.h b/src/gui/qt/gametable/myactionbutton.h index de04d0a1..a2f22837 100644 --- a/src/gui/qt/gametable/myactionbutton.h +++ b/src/gui/qt/gametable/myactionbutton.h @@ -15,6 +15,8 @@ #include #include +class GameTableStyleReader; + class MyActionButton : public QPushButton { public: @@ -25,9 +27,12 @@ public: void paintEvent(QPaintEvent * event); void setFKeyText ( const QString& theValue ){fKeyText = theValue;} + void setMyStyle ( GameTableStyleReader* theValue ) { myStyle = theValue; } + private: QString fKeyText; + GameTableStyleReader *myStyle; }; #endif diff --git a/src/gui/qt/gametable/mychancelabel.cpp b/src/gui/qt/gametable/mychancelabel.cpp index b1adb88b..3c6321f1 100644 --- a/src/gui/qt/gametable/mychancelabel.cpp +++ b/src/gui/qt/gametable/mychancelabel.cpp @@ -11,11 +11,13 @@ // #include "mychancelabel.h" #include "gametableimpl.h" +#include "gametablestylereader.h" using namespace std; MyChanceLabel::MyChanceLabel(QWidget* parent) - : QLabel(parent) { + : QLabel(parent), myW(0), myStyle(0) +{ } @@ -70,44 +72,47 @@ void MyChanceLabel::paintEvent(QPaintEvent * /*event*/) { painter.setFont(font); //Draw Texts - if(RFChance[1] == 0) { painter.setPen(QColor(85,99,47)); } - else { painter.setPen(QColor(156,213,0)); } + QColor possible("#"+myStyle->getChanceLabelPossibleColor()); + QColor impossible("#"+myStyle->getChanceLabelImpossibleColor()); + + if(RFChance[1] == 0) { painter.setPen(impossible); } + else { painter.setPen(possible); } painter.drawText(QRectF(QPointF(2,0), QPointF(85,13)),Qt::AlignRight,"Royal Flush"); painter.drawText(QRectF(QPointF(196,0), QPointF(236,13)),Qt::AlignRight,QString("%1%").arg(RFChance[0])); - if(SFChance[1] == 0) { painter.setPen(QColor(85,99,47)); } - else { painter.setPen(QColor(156,213,0)); } + if(SFChance[1] == 0) { painter.setPen(impossible); } + else { painter.setPen(possible); } painter.drawText(QRectF(QPointF(2,13), QPointF(85,26)),Qt::AlignRight,"Straight Flush"); painter.drawText(QRectF(QPointF(196,13), QPointF(236,26)),Qt::AlignRight,QString("%1%").arg(SFChance[0])); - if(FOAKChance[1] == 0) { painter.setPen(QColor(85,99,47)); } - else { painter.setPen(QColor(156,213,0)); } + if(FOAKChance[1] == 0) { painter.setPen(impossible); } + else { painter.setPen(possible); } painter.drawText(QRectF(QPointF(2,26), QPointF(85,39)),Qt::AlignRight,"Four of a Kind"); painter.drawText(QRectF(QPointF(196,26), QPointF(236,39)),Qt::AlignRight,QString("%1%").arg(FOAKChance[0])); - if(FHChance[1] == 0) { painter.setPen(QColor(85,99,47)); } - else { painter.setPen(QColor(156,213,0)); } + if(FHChance[1] == 0) { painter.setPen(impossible); } + else { painter.setPen(possible); } painter.drawText(QRectF(QPointF(2,39), QPointF(85,52)),Qt::AlignRight,"Full House"); painter.drawText(QRectF(QPointF(196,39), QPointF(236,52)),Qt::AlignRight,QString("%1%").arg(FHChance[0])); - if(FLChance[1] == 0) { painter.setPen(QColor(85,99,47)); } - else { painter.setPen(QColor(156,213,0)); } + if(FLChance[1] == 0) { painter.setPen(impossible); } + else { painter.setPen(possible); } painter.drawText(QRectF(QPointF(2,52), QPointF(85,65)),Qt::AlignRight,"Flush"); painter.drawText(QRectF(QPointF(196,52), QPointF(236,65)),Qt::AlignRight,QString("%1%").arg(FLChance[0])); - if(STRChance[1] == 0) { painter.setPen(QColor(85,99,47)); } - else { painter.setPen(QColor(156,213,0)); } + if(STRChance[1] == 0) { painter.setPen(impossible); } + else { painter.setPen(possible); } painter.drawText(QRectF(QPointF(2,65), QPointF(85,78)),Qt::AlignRight,"Straight"); painter.drawText(QRectF(QPointF(196,65), QPointF(236,78)),Qt::AlignRight,QString("%1%").arg(STRChance[0])); - if(TOAKChance[1] == 0) { painter.setPen(QColor(85,99,47)); } - else { painter.setPen(QColor(156,213,0)); } + if(TOAKChance[1] == 0) { painter.setPen(impossible); } + else { painter.setPen(possible); } painter.drawText(QRectF(QPointF(2,78), QPointF(85,91)),Qt::AlignRight,"Three of a Kind"); painter.drawText(QRectF(QPointF(196,78), QPointF(236,91)),Qt::AlignRight,QString("%1%").arg(TOAKChance[0])); - if(TPChance[1] == 0) { painter.setPen(QColor(85,99,47)); } - else { painter.setPen(QColor(156,213,0)); } + if(TPChance[1] == 0) { painter.setPen(impossible); } + else { painter.setPen(possible); } painter.drawText(QRectF(QPointF(2,91), QPointF(85,104)),Qt::AlignRight,"Two Pairs"); painter.drawText(QRectF(QPointF(196,91), QPointF(236,104)),Qt::AlignRight,QString("%1%").arg(TPChance[0])); - if(OPChance[1] == 0) { painter.setPen(QColor(85,99,47)); } - else { painter.setPen(QColor(156,213,0)); } + if(OPChance[1] == 0) { painter.setPen(impossible); } + else { painter.setPen(possible); } painter.drawText(QRectF(QPointF(2,104), QPointF(85,117)),Qt::AlignRight,"One Pair"); painter.drawText(QRectF(QPointF(196,104), QPointF(236,117)),Qt::AlignRight,QString("%1%").arg(OPChance[0])); - if(HCChance[1] == 0) { painter.setPen(QColor(85,99,47)); } - else { painter.setPen(QColor(156,213,0)); } + if(HCChance[1] == 0) { painter.setPen(impossible); } + else { painter.setPen(possible); } painter.drawText(QRectF(QPointF(2,117), QPointF(85,130)),Qt::AlignRight,"Highest Card"); painter.drawText(QRectF(QPointF(196,117), QPointF(236,130)),Qt::AlignRight,QString("%1%").arg(HCChance[0])); diff --git a/src/gui/qt/gametable/mychancelabel.h b/src/gui/qt/gametable/mychancelabel.h index 1893c641..8448d34f 100644 --- a/src/gui/qt/gametable/mychancelabel.h +++ b/src/gui/qt/gametable/mychancelabel.h @@ -18,6 +18,7 @@ #include class gameTableImpl; +class GameTableStyleReader; class MyChanceLabel : public QLabel { @@ -28,6 +29,7 @@ public: ~MyChanceLabel(); void setMyW ( gameTableImpl* theValue ) { myW = theValue; } + void setMyStyle ( GameTableStyleReader* theValue ) { myStyle = theValue; } void paintEvent(QPaintEvent * event); void refreshChance(std::vector< std::vector >); void resetChance(); @@ -35,6 +37,7 @@ public: private: gameTableImpl *myW; + GameTableStyleReader *myStyle; int RFChance[2]; int SFChance[2]; int FOAKChance[2]; diff --git a/src/gui/qt/styles/gametablestylereader.cpp b/src/gui/qt/styles/gametablestylereader.cpp index d9ca4805..8e9ffcd6 100644 --- a/src/gui/qt/styles/gametablestylereader.cpp +++ b/src/gui/qt/styles/gametablestylereader.cpp @@ -105,16 +105,19 @@ void GameTableStyleReader::readStyleFile(QString file) { if (tmpStr1) { tempString1 = tmpStr1; +// INFOS if(itemsList->ValueStr() == "StyleDescription") { StyleDescription = QString::fromUtf8(tempString1.c_str()); } else if(itemsList->ValueStr() == "StyleMaintainerEMail") { StyleMaintainerEMail = QString::fromUtf8(tempString1.c_str()); } +// WINDOWS SETTINGS + else if (itemsList->ValueStr() == "IfFixedWindowSize") { IfFixedWindowSize = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "FixedWindowWidth") { FixedWindowWidth = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "FixedWindowHeight") { FixedWindowHeight = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "MinimumWindowWidth") { MinimumWindowWidth = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "MinimumWindowHeight") { MinimumWindowHeight = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "MaximumWindowWidth") { MaximumWindowWidth = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "MaximumWindowHeight") { MaximumWindowHeight = QString::fromUtf8(tempString1.c_str()); } +// PICS else if (itemsList->ValueStr() == "Preview") { Preview = currentDir+QString::fromUtf8(tempString1.c_str()); } - else if (itemsList->ValueStr() == "IfFixedWindowSize") { IfFixedWindowSize = currentDir+QString::fromUtf8(tempString1.c_str()); } - else if (itemsList->ValueStr() == "FixedWindowWidth") { FixedWindowWidth = currentDir+QString::fromUtf8(tempString1.c_str()); } - else if (itemsList->ValueStr() == "FixedWindowHeight") { FixedWindowHeight = currentDir+QString::fromUtf8(tempString1.c_str()); } - else if (itemsList->ValueStr() == "MinimumWindowWidth") { MinimumWindowWidth = currentDir+QString::fromUtf8(tempString1.c_str()); } - else if (itemsList->ValueStr() == "MinimumWindowHeight") { MinimumWindowHeight = currentDir+QString::fromUtf8(tempString1.c_str()); } - else if (itemsList->ValueStr() == "MaximumWindowWidth") { MaximumWindowWidth = currentDir+QString::fromUtf8(tempString1.c_str()); } - else if (itemsList->ValueStr() == "MaximumWindowHeight") { MaximumWindowHeight = currentDir+QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "ActionAllIn") { ActionAllIn = currentDir+QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "ActionRaise") { ActionRaise = currentDir+QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "ActionBet") { ActionBet = currentDir+QString::fromUtf8(tempString1.c_str()); } @@ -150,7 +153,21 @@ void GameTableStyleReader::readStyleFile(QString file) { else if (itemsList->ValueStr() == "Table") { Table = currentDir+QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "HandRanking") { HandRanking = currentDir+QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "ToolBoxBackground") { ToolBoxBackground = currentDir+QString::fromUtf8(tempString1.c_str()); } - +// COLORS + else if (itemsList->ValueStr() == "FKeyIndicatorColor") { FKeyIndicatorColor = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "ChanceLabelPossibleColor") { ChanceLabelPossibleColor = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "ChanceLabelImpossibleColor") { ChanceLabelImpossibleColor = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "ChatTextNickNotifyColor") { ChatTextNickNotifyColor = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "ChatTextColor") { ChatTextColor = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "LogTextColor") { LogTextColor = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "LogWinnerMainPotColor") { LogWinnerMainPotColor = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "LogWinnerSidePotColor") { LogWinnerSidePotColor = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "LogPlayerSitsOutColor") { LogPlayerSitsOutColor = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "LogNewGameAdminColor") { LogNewGameAdminColor = QString::fromUtf8(tempString1.c_str()); } +// SIZES + else if (itemsList->ValueStr() == "ChatTextSize") { ChatTextSize = QString::fromUtf8(tempString1.c_str()); } + else if (itemsList->ValueStr() == "LogTextSize") { LogTextSize = QString::fromUtf8(tempString1.c_str()); } + // std::cout << "ÖLP" << itemsList->ValueStr() <<"§4s"<< itemsList->ValueStr()<<"§89"<< endl; } } @@ -196,10 +213,24 @@ void GameTableStyleReader::readStyleFile(QString file) { if(PlayerSeatActive == "") { wrongItems << "PlayerSeatActive"; } if(PlayerSeatInActive == "") { wrongItems << "PlayerSeatInActive"; } if(Table == "") { wrongItems << "Table"; } - + if(HandRanking == "") { wrongItems << "HandRanking"; } + if(ToolBoxBackground == "") { wrongItems << "ToolBoxBackground"; } + if(FKeyIndicatorColor == "") { wrongItems << "FKeyIndicatorColor"; } + if(ChanceLabelPossibleColor == "") { wrongItems << "ChanceLabelPossibleColor"; } + if(ChanceLabelImpossibleColor == "") { wrongItems << "ChanceLabelImpossibleColor"; } + if(ChatTextColor == "") { wrongItems << "ChatTextColor"; } + if(ChatTextNickNotifyColor == "") { wrongItems << "ChatTextNickNotifyColor"; } + if(LogTextColor == "") { wrongItems << "LogTextColor"; } + if(LogWinnerMainPotColor == "") { wrongItems << "LogWinnerMainPotColor"; } + if(LogWinnerSidePotColor == "") { wrongItems << "LogWinnerSidePotColor"; } + if(LogPlayerSitsOutColor == "") { wrongItems << "LogPlayerSitsOutColor"; } + if(LogNewGameAdminColor == "") { wrongItems << "LogNewGameAdminColor"; } + if(ChatTextSize == "") { wrongItems << "ChatTextSize"; } + if(LogTextSize == "") { wrongItems << "LogTextSize"; } + //if one or more items are wrong or left show detailed error message if(!wrongItems.isEmpty() && myW != 0) showErrorMessage(StyleDescription, wrongItems, StyleMaintainerEMail); - } + } else { qDebug() << "could not load game table style file: " << tinyFileName.c_str(); } } @@ -219,13 +250,13 @@ void GameTableStyleReader::setTableBackground(gameTableImpl *gt) void GameTableStyleReader::setLogStyle(QTextBrowser *tb) { - tb->setStyleSheet("QTextBrowser { "+ font1String +" font-size: "+textBrowserFontsize+"px; color: #F0F0F0; background-color: #1D3B00; border:none; } QScrollBar:vertical { border: 1px solid #104600; background: #135000; width: 15px; margin: 17px -1px 17px 0px; } QScrollBar::handle:vertical { border-radius: 1px; border: 1px solid #1B7200; background: #176400; 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 #1E7F00; background: #1A6F00; 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 #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: top; subcontrol-origin: margin; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { border: 1px solid #208A00; height: 3px; width: 3px; background: #27A800; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }"); + tb->setStyleSheet("QTextBrowser { "+ font1String +" font-size: "+LogTextSize+"px; color: #F0F0F0; background-color: #1D3B00; border:none; } QScrollBar:vertical { border: 1px solid #104600; background: #135000; width: 15px; margin: 17px -1px 17px 0px; } QScrollBar::handle:vertical { border-radius: 1px; border: 1px solid #1B7200; background: #176400; 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 #1E7F00; background: #1A6F00; 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 #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: top; subcontrol-origin: margin; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { border: 1px solid #208A00; height: 3px; width: 3px; background: #27A800; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }"); } void GameTableStyleReader::setChatStyle(QTextBrowser *tb) { - tb->setStyleSheet("QTextBrowser { "+ font1String +" font-size: "+textBrowserFontsize+"px; color: #F0F0F0; background-color: #1D3B00; border:none; } QScrollBar:vertical { border: 1px solid #104600; background: #135000; width: 15px; margin: 17px -1px 17px 0px; } QScrollBar::handle:vertical { border-radius: 1px; border: 1px solid #1B7200; background: #176400; 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 #1E7F00; background: #1A6F00; 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 #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: top; subcontrol-origin: margin; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { border: 1px solid #208A00; height: 3px; width: 3px; background: #27A800; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }"); + tb->setStyleSheet("QTextBrowser { "+ font1String +" font-size: "+ChatTextSize+"px; color: #F0F0F0; background-color: #1D3B00; border:none; } QScrollBar:vertical { border: 1px solid #104600; background: #135000; width: 15px; margin: 17px -1px 17px 0px; } QScrollBar::handle:vertical { border-radius: 1px; border: 1px solid #1B7200; background: #176400; 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 #1E7F00; background: #1A6F00; 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 #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: top; subcontrol-origin: margin; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { border: 1px solid #208A00; height: 3px; width: 3px; background: #27A800; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }"); } void GameTableStyleReader::setChatInputStyle(QLineEdit *ci) @@ -275,9 +306,17 @@ void GameTableStyleReader::setMenuBarStyle(QMenuBar *mb) mb->setStyleSheet("QMenuBar { background-color: #145300; } QMenuBar::item { color: #99D500; }"); } -void GameTableStyleReader::setBreakButtonStyle(QPushButton *bb) +void GameTableStyleReader::setBreakButtonStyle(QPushButton *bb, int state) { - bb->setStyleSheet("QPushButton:enabled { background-color: #145300; color: #99D500;} QPushButton:disabled { background-color: #145300; color: #486F3E; font-weight: 900;}"); + switch(state) { +// default + case 0: bb->setStyleSheet("QPushButton:enabled { background-color: #145300; color: #99D500;} QPushButton:disabled { background-color: #145300; color: #486F3E; font-weight: 900;}"); + break; +// blink + case 1: bb->setStyleSheet("QPushButton { background-color: #6E9E00; color: black;}"); + + break; + } } void GameTableStyleReader::setSpeedStringStyle(QLabel *l) @@ -337,8 +376,13 @@ QString GameTableStyleReader::getActionPic(int action) } } -void GameTableStyleReader::setButtonsStyle(QPushButton *br, QPushButton *cc, QPushButton *f, QPushButton *a, int state) +void GameTableStyleReader::setButtonsStyle(MyActionButton *br, MyActionButton *cc, MyActionButton *f, MyActionButton *a, int state) { + br->setMyStyle(this); + cc->setMyStyle(this); + f->setMyStyle(this); + a->setMyStyle(this); + switch(state) { //default case 0: { diff --git a/src/gui/qt/styles/gametablestylereader.h b/src/gui/qt/styles/gametablestylereader.h index d519518e..df286bc4 100644 --- a/src/gui/qt/styles/gametablestylereader.h +++ b/src/gui/qt/styles/gametablestylereader.h @@ -27,6 +27,8 @@ #include #include +class gameTableImpl; + class GameTableStyleReader : public QObject { Q_OBJECT public: @@ -45,6 +47,11 @@ public: QString getSmallBlindPuck() const { return SmallBlindPuck; } QString getBigBlindPuck() const { return BigBlindPuck; } QString getHandRanking() const { return HandRanking; } + QString getFKeyIndicatorColor() const { return FKeyIndicatorColor; } + QString getChanceLabelImpossibleColor() const { return ChanceLabelImpossibleColor; } + QString getChanceLabelPossibleColor() const { return ChanceLabelPossibleColor; } + QString getChatTextColor() const { return ChatTextColor; } + QString getChatTextNickNotifyColor() const { return ChatTextNickNotifyColor; } QString getActionPic(int); @@ -67,7 +74,7 @@ public: void setSmallFontBoardStyle(QLabel*); void setBigFontBoardStyle(QLabel*); void setMenuBarStyle(QMenuBar*); - void setBreakButtonStyle(QPushButton*); + void setBreakButtonStyle(QPushButton*, int); void setSpeedStringStyle(QLabel*); void setVoteButtonStyle(QPushButton*); void setVoteStringsStyle(QLabel*); @@ -76,14 +83,20 @@ public: void setTabWidgetStyle(QTabWidget*, QTabBar*); //set pics and fonts and colors - void setButtonsStyle(QPushButton*, QPushButton*, QPushButton*, QPushButton*, int); + void setButtonsStyle(MyActionButton*, MyActionButton*, MyActionButton*, MyActionButton*, int); void setAwayRadioButtonsStyle(QRadioButton*); + QString getLogWinnerMainPotColor() const { return LogWinnerMainPotColor; } + QString getLogWinnerSidePotColor() const { return LogWinnerSidePotColor; } + QString getLogPlayerSitsOutColor() const { return LogPlayerSitsOutColor; } + QString getLogNewGameAdminColor() const { return LogNewGameAdminColor; } + private: - + //style values +// INFOS QString StyleDescription; QString StyleMaintainerEMail; - QString Preview; +// WINDOWS SETTINGS QString IfFixedWindowSize; QString FixedWindowWidth; QString FixedWindowHeight; @@ -91,6 +104,8 @@ private: QString MinimumWindowHeight; QString MaximumWindowWidth; QString MaximumWindowHeight; +// PICS + QString Preview; QString ActionAllIn; QString ActionRaise; QString ActionBet; @@ -126,7 +141,22 @@ private: QString Table; QString HandRanking; QString ToolBoxBackground; +// COLORS + QString FKeyIndicatorColor; + QString ChanceLabelPossibleColor; + QString ChanceLabelImpossibleColor; + QString ChatTextColor; + QString ChatTextNickNotifyColor; + QString LogTextColor; + QString LogWinnerMainPotColor; + QString LogWinnerSidePotColor; + QString LogPlayerSitsOutColor; + QString LogNewGameAdminColor; +// SIZES + QString ChatTextSize; + QString LogTextSize; + //internal QString font2String; QString font1String; QString textBrowserFontsize;