implement #79 - show cards chances also after fold
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
using namespace std;
|
||||
|
||||
MyChanceLabel::MyChanceLabel(QWidget* parent)
|
||||
: QLabel(parent), myW(0), myStyle(0)
|
||||
: QLabel(parent), myW(0), myStyle(0), myFoldState(false)
|
||||
{
|
||||
RFChance[0] = 0;
|
||||
SFChance[0] = 0;
|
||||
@@ -51,7 +51,7 @@ MyChanceLabel::~MyChanceLabel()
|
||||
{
|
||||
}
|
||||
|
||||
void MyChanceLabel::refreshChance(vector< vector<int> > chance)
|
||||
void MyChanceLabel::refreshChance(vector< vector<int> > chance, bool fold)
|
||||
{
|
||||
RFChance[0] = chance[0][9];
|
||||
SFChance[0] = chance[0][8];
|
||||
@@ -75,6 +75,8 @@ void MyChanceLabel::refreshChance(vector< vector<int> > chance)
|
||||
OPChance[1] = chance[1][1];
|
||||
HCChance[1] = chance[1][0];
|
||||
|
||||
myFoldState = fold;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -102,70 +104,70 @@ void MyChanceLabel::paintEvent(QPaintEvent * /*event*/)
|
||||
QColor possible("#"+myStyle->getChanceLabelPossibleColor());
|
||||
QColor impossible("#"+myStyle->getChanceLabelImpossibleColor());
|
||||
|
||||
if(RFChance[1] == 0) {
|
||||
if(RFChance[1] == 0 || myFoldState) {
|
||||
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) {
|
||||
if(SFChance[1] == 0 || myFoldState) {
|
||||
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) {
|
||||
if(FOAKChance[1] == 0 || myFoldState) {
|
||||
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) {
|
||||
if(FHChance[1] == 0 || myFoldState) {
|
||||
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) {
|
||||
if(FLChance[1] == 0 || myFoldState) {
|
||||
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) {
|
||||
if(STRChance[1] == 0 || myFoldState) {
|
||||
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) {
|
||||
if(TOAKChance[1] == 0 || myFoldState) {
|
||||
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) {
|
||||
if(TPChance[1] == 0 || myFoldState) {
|
||||
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) {
|
||||
if(OPChance[1] == 0 || myFoldState) {
|
||||
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) {
|
||||
if(HCChance[1] == 0 || myFoldState) {
|
||||
painter.setPen(impossible);
|
||||
} else {
|
||||
painter.setPen(possible);
|
||||
@@ -182,6 +184,9 @@ void MyChanceLabel::paintEvent(QPaintEvent * /*event*/)
|
||||
linearGrad.setColorAt(1, Qt::red);
|
||||
painter.setBrush(linearGrad);
|
||||
|
||||
if(myFoldState) { painter.setOpacity(0.4); }
|
||||
else { painter.setOpacity(1.0); }
|
||||
|
||||
if(RFChance[1] != 0) painter.drawRect(89,3,(108*RFChance[0])/100,7);
|
||||
if(SFChance[1] != 0) painter.drawRect(89,16,(108*SFChance[0])/100,7);
|
||||
if(FOAKChance[1] != 0) painter.drawRect(89,29,(108*FOAKChance[0])/100,7);
|
||||
@@ -219,5 +224,6 @@ void MyChanceLabel::resetChance()
|
||||
OPChance[1] = 0;
|
||||
HCChance[1] = 0;
|
||||
|
||||
myFoldState = false;
|
||||
update();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user