first colors and font sizes are skinnable now

This commit is contained in:
doitux
2009-04-01 12:27:31 +00:00
parent 6d973aa178
commit b944852a4e
16 changed files with 355 additions and 242 deletions
+6
View File
@@ -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);
}
+2
View File
@@ -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; }
+10 -14
View File
@@ -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; i<MAX_NUMBER_OF_PLAYERS; i++) {
@@ -3196,7 +3193,7 @@ void gameTableImpl::refreshGameTableStyle()
myGameTableStyle->setCardHolderStyle(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());
}
+2
View File
@@ -64,6 +64,8 @@ public:
SDLPlayer* getMySDLPlayer() const { return mySDLPlayer; }
Chat* getMyChat() const { return myChat; }
GameTableStyleReader* getMyGameTableStyle() const { return myGameTableStyle; }
void setSpeeds();
+6 -4
View File
@@ -24,12 +24,14 @@
#include <session.h>
#include <game.h>
#include <game_defs.h>
#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("<span style=\"color:#FFFF00;\">"+playerName+" wins $"+QString::number(pot,10)+"</span>");
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogWinnerMainPotColor()+";\">"+playerName+" wins $"+QString::number(pot,10)+"</span>");
} else {
myW->textBrowser_Log->append("<span style=\"color:#FFFFCC;\">"+playerName+" wins $"+QString::number(pot,10)+" (side pot)</span>");
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogWinnerSidePotColor()+";\">"+playerName+" wins $"+QString::number(pot,10)+" (side pot)</span>");
}
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("<i><span style=\"color:#FF6633;\">"+playerName+" sits out</span></i>");
myW->textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
if(myConfig->readConfigInt("LogOnOff")) {
@@ -344,7 +346,7 @@ void Log::logPlayerLeftMsg(QString playerName, int wasKicked) {
void Log::logNewGameAdminMsg(QString playerName) {
myW->textBrowser_Log->append( "<i><span style=\"color:#69FF33;\">"+playerName+" is game admin now!</span></i>");
myW->textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
if(myConfig->readConfigInt("LogOnOff")) {
+3 -1
View File
@@ -28,7 +28,7 @@
#include <QtCore>
class gameTableImpl;
class GameTableStyleReader;
class Log : public QObject
{
@@ -87,6 +87,8 @@ private:
QString logFileStreamString;
QString myAppDataPath;
GameTableStyleReader *myStyle;
friend class GuiWrapper;
};
+2 -2
View File
@@ -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);
+5
View File
@@ -15,6 +15,8 @@
#include <QtGui>
#include <QtCore>
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
+26 -21
View File
@@ -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]));
+3
View File
@@ -18,6 +18,7 @@
#include <QtCore>
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<int> >);
void resetChance();
@@ -35,6 +37,7 @@ public:
private:
gameTableImpl *myW;
GameTableStyleReader *myStyle;
int RFChance[2];
int SFChance[2];
int FOAKChance[2];