fix image distortion for card images after playing a while
This commit is contained in:
@@ -86,13 +86,12 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
pixmapLabel_card0a->setMyW(this);
|
pixmapLabel_card0a->setMyW(this);
|
||||||
|
|
||||||
//Flipside festlegen;
|
//Flipside festlegen;
|
||||||
flipside = new QPixmap(myAppDataPath +"gfx/cards/default/flipside.png");
|
|
||||||
|
|
||||||
if (myConfig->readConfigInt("FlipsideOwn") && myConfig->readConfigString("FlipsideOwnFile") != "") {
|
if (myConfig->readConfigInt("FlipsideOwn") && myConfig->readConfigString("FlipsideOwnFile") != "") {
|
||||||
QPixmap tmpFlipside(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
|
flipside = new QPixmap(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
|
||||||
flipside = new QPixmap(tmpFlipside.scaled(QSize(80, 111),Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
}
|
||||||
|
else {
|
||||||
|
flipside = new QPixmap(myAppDataPath +"gfx/cards/default/flipside.png");
|
||||||
}
|
}
|
||||||
else { flipside->load(myAppDataPath +"gfx/cards/default/flipside.png"); }
|
|
||||||
|
|
||||||
//Flipside Animation noch nicht erledigt
|
//Flipside Animation noch nicht erledigt
|
||||||
flipHolecardsAllInAlreadyDone = FALSE;
|
flipHolecardsAllInAlreadyDone = FALSE;
|
||||||
@@ -1019,11 +1018,11 @@ void mainWindowImpl::callSettingsDialog() {
|
|||||||
|
|
||||||
//Flipside refresh
|
//Flipside refresh
|
||||||
if (myConfig->readConfigInt("FlipsideOwn") && myConfig->readConfigString("FlipsideOwnFile") != "") {
|
if (myConfig->readConfigInt("FlipsideOwn") && myConfig->readConfigString("FlipsideOwnFile") != "") {
|
||||||
|
flipside = new QPixmap(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
|
||||||
QPixmap tmpFlipside(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
|
}
|
||||||
flipside = new QPixmap(tmpFlipside.scaled(QSize(57, 80)));
|
else {
|
||||||
|
flipside = new QPixmap(myAppDataPath +"gfx/cards/default/flipside.png");
|
||||||
}
|
}
|
||||||
else { flipside->load(myAppDataPath +"gfx/cards/default/flipside.png"); }
|
|
||||||
|
|
||||||
if(mySession->getCurrentGame()) {
|
if(mySession->getCurrentGame()) {
|
||||||
//blind buttons refresh
|
//blind buttons refresh
|
||||||
@@ -1639,7 +1638,7 @@ void mainWindowImpl::dealFlopCards4() {
|
|||||||
//Config? mit oder ohne Eye-Candy?
|
//Config? mit oder ohne Eye-Candy?
|
||||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||||
//mit Eye-Candy
|
//mit Eye-Candy
|
||||||
boardCardsArray[0]->startFlipCards(guiGameSpeed, card, flipside);
|
boardCardsArray[0]->startFlipCards(guiGameSpeed, card, *flipside);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//ohne Eye-Candy
|
//ohne Eye-Candy
|
||||||
@@ -1659,7 +1658,7 @@ void mainWindowImpl::dealFlopCards5() {
|
|||||||
//Config? mit oder ohne Eye-Candy?
|
//Config? mit oder ohne Eye-Candy?
|
||||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||||
//mit Eye-Candy
|
//mit Eye-Candy
|
||||||
boardCardsArray[1]->startFlipCards(guiGameSpeed, card, flipside);
|
boardCardsArray[1]->startFlipCards(guiGameSpeed, card, *flipside);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//ohne Eye-Candy
|
//ohne Eye-Candy
|
||||||
@@ -1679,7 +1678,7 @@ void mainWindowImpl::dealFlopCards6() {
|
|||||||
//Config? mit oder ohne Eye-Candy?
|
//Config? mit oder ohne Eye-Candy?
|
||||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||||
//mit Eye-Candy
|
//mit Eye-Candy
|
||||||
boardCardsArray[2]->startFlipCards(guiGameSpeed, card, flipside);
|
boardCardsArray[2]->startFlipCards(guiGameSpeed, card, *flipside);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//ohne Eye-Candy
|
//ohne Eye-Candy
|
||||||
@@ -1715,7 +1714,7 @@ void mainWindowImpl::dealTurnCards2() {
|
|||||||
//Config? mit oder ohne Eye-Candy?
|
//Config? mit oder ohne Eye-Candy?
|
||||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||||
//mit Eye-Candy
|
//mit Eye-Candy
|
||||||
boardCardsArray[3]->startFlipCards(guiGameSpeed, card, flipside);
|
boardCardsArray[3]->startFlipCards(guiGameSpeed, card, *flipside);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//ohne Eye-Candy
|
//ohne Eye-Candy
|
||||||
@@ -1739,6 +1738,7 @@ void mainWindowImpl::dealRiverCards0() { dealRiverCards0Timer->start(preDealCard
|
|||||||
void mainWindowImpl::dealRiverCards1() {
|
void mainWindowImpl::dealRiverCards1() {
|
||||||
|
|
||||||
boardCardsArray[4]->setPixmap(*flipside, TRUE);
|
boardCardsArray[4]->setPixmap(*flipside, TRUE);
|
||||||
|
|
||||||
// QTimer::singleShot(dealCardsSpeed, this, SLOT( dealRiverCards2() ));
|
// QTimer::singleShot(dealCardsSpeed, this, SLOT( dealRiverCards2() ));
|
||||||
dealRiverCards1Timer->start(dealCardsSpeed);
|
dealRiverCards1Timer->start(dealCardsSpeed);
|
||||||
}
|
}
|
||||||
@@ -1754,7 +1754,7 @@ void mainWindowImpl::dealRiverCards2() {
|
|||||||
//Config? mit oder ohne Eye-Candy?
|
//Config? mit oder ohne Eye-Candy?
|
||||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||||
//mit Eye-Candy
|
//mit Eye-Candy
|
||||||
boardCardsArray[4]->startFlipCards(guiGameSpeed, card, flipside);
|
boardCardsArray[4]->startFlipCards(guiGameSpeed, card, *flipside);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//ohne Eye-Candy
|
//ohne Eye-Candy
|
||||||
@@ -2485,7 +2485,7 @@ void mainWindowImpl::postRiverRunAnimation2() {
|
|||||||
if((*it_c)->getMyID() || ((*it_c)->getMyID()==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
if((*it_c)->getMyID() || ((*it_c)->getMyID()==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
||||||
for(j=0; j<2; j++) {
|
for(j=0; j<2; j++) {
|
||||||
|
|
||||||
holeCardsArray[(*it_c)->getMyID()][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
|
holeCardsArray[(*it_c)->getMyID()][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), *flipside);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//set Player value (logging)
|
//set Player value (logging)
|
||||||
@@ -2828,7 +2828,7 @@ void mainWindowImpl::flipHolecardsAllIn() {
|
|||||||
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||||
if((*it_c)->getMyID() || ((*it_c)->getMyID()==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
if((*it_c)->getMyID() || ((*it_c)->getMyID()==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
||||||
for(j=0; j<2; j++) {
|
for(j=0; j<2; j++) {
|
||||||
holeCardsArray[(*it_c)->getMyID()][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
|
holeCardsArray[(*it_c)->getMyID()][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), *flipside);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//set Player value (logging)
|
//set Player value (logging)
|
||||||
|
|||||||
@@ -29,10 +29,7 @@ MyCardsPixmapLabel::MyCardsPixmapLabel(QFrame* parent)
|
|||||||
// rotationIntervall = 0.03;
|
// rotationIntervall = 0.03;
|
||||||
|
|
||||||
isFlipside = FALSE;
|
isFlipside = FALSE;
|
||||||
|
|
||||||
front = new QPixmap;
|
|
||||||
flipside = new QPixmap;
|
|
||||||
|
|
||||||
fadeOutTimer = new QTimer;
|
fadeOutTimer = new QTimer;
|
||||||
connect(fadeOutTimer, SIGNAL(timeout()), this, SLOT(nextFadeOutFrame()));
|
connect(fadeOutTimer, SIGNAL(timeout()), this, SLOT(nextFadeOutFrame()));
|
||||||
flipCardsTimer = new QTimer;
|
flipCardsTimer = new QTimer;
|
||||||
@@ -78,7 +75,7 @@ void MyCardsPixmapLabel::nextFadeOutFrame() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyCardsPixmapLabel::startFlipCards(int speed, QPixmap frontPix, QPixmap *flipsidePix) {
|
void MyCardsPixmapLabel::startFlipCards(int speed, const QPixmap &frontPix, const QPixmap &flipsidePix) {
|
||||||
|
|
||||||
stopFlipCards = FALSE;
|
stopFlipCards = FALSE;
|
||||||
|
|
||||||
@@ -87,11 +84,8 @@ void MyCardsPixmapLabel::startFlipCards(int speed, QPixmap frontPix, QPixmap *fl
|
|||||||
frameFlipCardsAction1Size = 1.0;
|
frameFlipCardsAction1Size = 1.0;
|
||||||
frameFlipCardsAction2Size = 0.0;
|
frameFlipCardsAction2Size = 0.0;
|
||||||
|
|
||||||
*front = frontPix;
|
front = frontPix.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);;
|
||||||
flipside = flipsidePix;
|
flipside = flipsidePix.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);;
|
||||||
|
|
||||||
*flipside = flipside->scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
|
||||||
*front = front->scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
|
||||||
|
|
||||||
if(speed <= 4) { flipCardsScaleIntervall = 0.1; }
|
if(speed <= 4) { flipCardsScaleIntervall = 0.1; }
|
||||||
if(speed > 4 && speed <= 6) { flipCardsScaleIntervall = 0.20; }
|
if(speed > 4 && speed <= 6) { flipCardsScaleIntervall = 0.20; }
|
||||||
@@ -152,7 +146,7 @@ void MyCardsPixmapLabel::setPixmap(const QPixmap &pic, const bool flipsideIs) {
|
|||||||
|
|
||||||
void MyCardsPixmapLabel::setFrontPixmap ( const QPixmap &pic ) {
|
void MyCardsPixmapLabel::setFrontPixmap ( const QPixmap &pic ) {
|
||||||
|
|
||||||
myHiddenFront = pic;
|
myHiddenFront = pic.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) {
|
void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) {
|
||||||
@@ -180,26 +174,26 @@ void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) {
|
|||||||
|
|
||||||
if (flipCardsAction1) {
|
if (flipCardsAction1) {
|
||||||
QPainter painter2(this);
|
QPainter painter2(this);
|
||||||
QPointF center(flipside->width()/2.0, flipside->height()/2.0);
|
QPointF center(flipside.width()/2.0, flipside.height()/2.0);
|
||||||
painter2.translate(center);
|
painter2.translate(center);
|
||||||
painter2.scale(frameFlipCardsAction1Size ,1);
|
painter2.scale(frameFlipCardsAction1Size ,1);
|
||||||
painter2.translate(-center);
|
painter2.translate(-center);
|
||||||
painter2.drawPixmap(0,0, *flipside);
|
painter2.drawPixmap(0,0, flipside);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flipCardsAction2) {
|
if (flipCardsAction2) {
|
||||||
QPainter painter3(this);
|
QPainter painter3(this);
|
||||||
QPointF center(front->width()/2.0, front->height()/2.0);
|
QPointF center(front.width()/2.0, front.height()/2.0);
|
||||||
painter3.translate(center);
|
painter3.translate(center);
|
||||||
painter3.scale(frameFlipCardsAction2Size ,1);
|
painter3.scale(frameFlipCardsAction2Size ,1);
|
||||||
painter3.translate(-center);
|
painter3.translate(-center);
|
||||||
painter3.drawPixmap(0,0, *front);
|
painter3.drawPixmap(0,0, front);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fastFlipCardsFront && !fadeOutAction && !flipCardsAction1 && !flipCardsAction2) {
|
if (fastFlipCardsFront && !fadeOutAction && !flipCardsAction1 && !flipCardsAction2) {
|
||||||
if(objectName().contains("pixmapLabel_card0")) {
|
if(objectName().contains("pixmapLabel_card0")) {
|
||||||
QPainter painter4(this);
|
QPainter painter4(this);
|
||||||
painter4.drawPixmap(0,0, myHiddenFront.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
painter4.drawPixmap(0,0, myHiddenFront);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,14 +36,11 @@ public:
|
|||||||
bool getFadeOutAction() const { return fadeOutAction;}
|
bool getFadeOutAction() const { return fadeOutAction;}
|
||||||
|
|
||||||
void startFadeOut(int);
|
void startFadeOut(int);
|
||||||
void startFlipCards(int, QPixmap, QPixmap*);
|
void startFlipCards(int, const QPixmap & , const QPixmap &);
|
||||||
void stopFlipCardsAnimation();
|
void stopFlipCardsAnimation();
|
||||||
|
|
||||||
void paintEvent(QPaintEvent * event);
|
void paintEvent(QPaintEvent * event);
|
||||||
|
|
||||||
QPixmap *front;
|
|
||||||
QPixmap *flipside;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalFastFlipCards(bool);
|
void signalFastFlipCards(bool);
|
||||||
|
|
||||||
@@ -51,7 +48,7 @@ signals:
|
|||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void setPixmap ( const QPixmap &, const bool );
|
void setPixmap ( const QPixmap &, const bool );
|
||||||
void setFrontPixmap ( const QPixmap & );
|
void setFrontPixmap ( const QPixmap &);
|
||||||
|
|
||||||
void nextFadeOutFrame();
|
void nextFadeOutFrame();
|
||||||
void nextFlipCardsFrame();
|
void nextFlipCardsFrame();
|
||||||
@@ -86,6 +83,8 @@ private:
|
|||||||
bool mousePress;
|
bool mousePress;
|
||||||
bool fastFlipCardsFront;
|
bool fastFlipCardsFront;
|
||||||
|
|
||||||
|
QPixmap front;
|
||||||
|
QPixmap flipside;
|
||||||
QPixmap myHiddenFront;
|
QPixmap myHiddenFront;
|
||||||
|
|
||||||
friend class mainWindowImpl;
|
friend class mainWindowImpl;
|
||||||
|
|||||||
Reference in New Issue
Block a user