diff --git a/pokerth_game.pro b/pokerth_game.pro index 7330b6ad..b3e4da88 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -116,6 +116,7 @@ HEADERS += \ src/gui/qt/mainwindow/mainwindowimpl.h \ src/gui/qt/mainwindow/mycardspixmaplabel.h \ src/gui/qt/mainwindow/mysetlabel.h \ + src/gui/qt/mainwindow/mystatuslabel.h \ src/gui/qt/mainwindow/myrighttabwidget.h \ src/gui/qt/mainwindow/mylefttabwidget.h \ src/gui/qt/mainwindow/startsplash/startsplash.h \ @@ -158,6 +159,7 @@ SOURCES += \ src/gui/qt/mainwindow/mainwindowimpl.cpp \ src/gui/qt/mainwindow/mycardspixmaplabel.cpp \ src/gui/qt/mainwindow/mysetlabel.cpp \ + src/gui/qt/mainwindow/mystatuslabel.cpp \ src/gui/qt/mainwindow/myrighttabwidget.cpp \ src/gui/qt/mainwindow/mylefttabwidget.cpp \ src/gui/qt/mainwindow/startsplash/startsplash.cpp \ @@ -262,7 +264,7 @@ mac{ #CONFIG += qt thread embed_manifest_exe release CONFIG += qt thread embed_manifest_exe warn_on debug UI_DIR = uics -TARGET = bin/pokerth_game +TARGET = bin/pokerth MOC_DIR = mocs OBJECTS_DIR = obj QT += diff --git a/src/gui/qt/mainwindow.ui b/src/gui/qt/mainwindow.ui index 32457348..be68024a 100644 --- a/src/gui/qt/mainwindow.ui +++ b/src/gui/qt/mainwindow.ui @@ -1668,7 +1668,7 @@ 111 - + 9 @@ -6068,7 +6068,7 @@ 0 0 1000 - 30 + 29 @@ -6182,6 +6182,11 @@ QTabWidget
myrighttabwidget.h
+ + MyStatusLabel + QLabel +
mystatuslabel.h
+
MySetLabel QLabel diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 63ffeb53..aa2cd5b9 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -140,6 +140,9 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent) pixmapLabel_card0b->setScaledContents(true); pixmapLabel_card0b->setGeometry(QRect(39, 0, 80, 111)); + pixmapLabel_card0b->setMyW(this); + pixmapLabel_card0a->setMyW(this); + pixmapLabel_card1a = new MyCardsPixmapLabel(frame_Cards1); pixmapLabel_card1a->setObjectName(QString::fromUtf8("pixmapLabel_card1a")); pixmapLabel_card1a->setScaledContents(true); @@ -371,6 +374,8 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent) actionLabelArray[5] = textLabel_Status5; actionLabelArray[6] = textLabel_Status6; + textLabel_Status0->setMyW(this); + // GroupBoxArray init groupBoxArray[0] = groupBox0; groupBoxArray[1] = groupBox1; @@ -1310,7 +1315,10 @@ void mainWindowImpl::dealHoleCards() { holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j],FALSE); } - else holeCardsArray[i][j]->setPixmap(*flipside, TRUE); + else { + holeCardsArray[i][j]->setPixmap(*flipside, TRUE); +/* holeCardsArray[i][j]->setStyleSheet("QLabel:hover { background-image:url(:/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");*/ + } } else { @@ -2675,6 +2683,12 @@ void mainWindowImpl::networkGameModification() { } +void mainWindowImpl::mouseOverFlipCards(bool front) { + + holeCardsArray[0][0]->signalFastFlipCards(front); + holeCardsArray[0][1]->signalFastFlipCards(front); +} + void mainWindowImpl::closeEvent(QCloseEvent *event) { quitPokerTH(); } void mainWindowImpl::quitPokerTH() { diff --git a/src/gui/qt/mainwindow/mainwindowimpl.h b/src/gui/qt/mainwindow/mainwindowimpl.h index 9396ba69..67372fb4 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.h +++ b/src/gui/qt/mainwindow/mainwindowimpl.h @@ -275,6 +275,8 @@ public slots: void localGameModification(); void networkGameModification(); + void mouseOverFlipCards(bool front); + void quitPokerTH(); diff --git a/src/gui/qt/mainwindow/mycardspixmaplabel.cpp b/src/gui/qt/mainwindow/mycardspixmaplabel.cpp index 5a10d93c..891a40cf 100644 --- a/src/gui/qt/mainwindow/mycardspixmaplabel.cpp +++ b/src/gui/qt/mainwindow/mycardspixmaplabel.cpp @@ -14,13 +14,17 @@ // using namespace std; MyCardsPixmapLabel::MyCardsPixmapLabel(QFrame* parent) - : QLabel(parent) + : QLabel(parent), myW(NULL) { + + this->setMouseTracking(TRUE); + fadeOutAction = FALSE; flipCardsAction1 = FALSE; flipCardsAction2 = FALSE; - + mousePress = FALSE; + fastFlipCardsFront = FALSE; // rotationIntervall = 0.03; @@ -33,6 +37,8 @@ MyCardsPixmapLabel::MyCardsPixmapLabel(QFrame* parent) connect(fadeOutTimer, SIGNAL(timeout()), this, SLOT(nextFadeOutFrame())); flipCardsTimer = new QTimer; connect(flipCardsTimer, SIGNAL(timeout()), this, SLOT(nextFlipCardsFrame())); + + connect(this, SIGNAL(signalFastFlipCards(bool)), this, SLOT(fastFlipCards(bool))); } @@ -187,14 +193,44 @@ void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) { painter3.drawPixmap(0,0, tmpFront); } - + if (fastFlipCardsFront) { QPainter painter(this); + painter.setBrush(QColor(0,0,0)); + if(objectName().contains("pixmapLabel_card0")) { + painter.drawRect(10,10,20,20); + } + } + } -// bool MyCardsPixmapLabel::event ( QEvent * event ) { -// -// if(event->type() == QEvent::MouseMove) { event->ignore(); } -// QLabel::event(event); -// } +void MyCardsPixmapLabel::fastFlipCards(bool front){ + if (front) { + fastFlipCardsFront = TRUE; + update(); + } + else { + fastFlipCardsFront = FALSE; + update(); + } +} +void MyCardsPixmapLabel::mousePressEvent(QMouseEvent * event) { + if (!mousePress && objectName().contains("pixmapLabel_card0")) { + mousePress = TRUE; + myW->mouseOverFlipCards(TRUE); + + } + +QLabel::mousePressEvent(event); +} + +void MyCardsPixmapLabel::mouseReleaseEvent(QMouseEvent * event) { + + if (mousePress && objectName().contains("pixmapLabel_card0")) { + mousePress = FALSE; + myW->mouseOverFlipCards(FALSE); + } + +QLabel::mouseReleaseEvent(event); +} diff --git a/src/gui/qt/mainwindow/mycardspixmaplabel.h b/src/gui/qt/mainwindow/mycardspixmaplabel.h index 44abbc5d..115c1bfc 100644 --- a/src/gui/qt/mainwindow/mycardspixmaplabel.h +++ b/src/gui/qt/mainwindow/mycardspixmaplabel.h @@ -12,9 +12,12 @@ #ifndef MYCARDSPIXMAPLABEL_H #define MYCARDSPIXMAPLABEL_H +#include + #include #include +#include "mainwindowimpl.h" class MyCardsPixmapLabel : public QLabel { @@ -24,6 +27,8 @@ public: ~MyCardsPixmapLabel(); + void setMyW ( mainWindowImpl* theValue ) { myW = theValue; } + void setIsFlipside(bool theValue){ isFlipside = theValue;} bool getIsFlipside() const{ return isFlipside;} @@ -39,18 +44,29 @@ public: QPixmap *front; QPixmap *flipside; +signals: + void signalFastFlipCards(bool); + public slots: void setPixmap ( const QPixmap &, const bool ); +// void setFrontPixmap ( const QPixmap & ); + void nextFadeOutFrame(); void nextFlipCardsFrame(); - -// bool event ( QEvent * ); + void fastFlipCards(bool front); + +// void mouseMoveEvent ( QMouseEvent *); + + void mousePressEvent ( QMouseEvent *); + void mouseReleaseEvent ( QMouseEvent *); private: + mainWindowImpl* myW; + qreal frameOpacity; qreal opacityRaiseIntervall; @@ -61,12 +77,16 @@ private: QTimer *fadeOutTimer; QTimer *flipCardsTimer; - bool isFlipside; bool fadeOutAction; bool flipCardsAction1; bool flipCardsAction2; bool stopFlipCards; + + bool mousePress; + bool fastFlipCardsFront; + +friend class mainWindowImpl; }; #endif diff --git a/src/gui/qt/mainwindow/mystatuslabel.cpp b/src/gui/qt/mainwindow/mystatuslabel.cpp new file mode 100644 index 00000000..1206111b --- /dev/null +++ b/src/gui/qt/mainwindow/mystatuslabel.cpp @@ -0,0 +1,48 @@ +// +// C++ Implementation: mycardspixmaplabel +// +// Description: +// +// +// Author: FThauer FHammer , (C) 2007 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include "mysetlabel.h" + +#include "mainwindowimpl.h" + +using namespace std; + +MyStatusLabel::MyStatusLabel(QFrame* parent) + : QLabel(parent) { + + mousePress = FALSE; + +} + +MyStatusLabel::~MyStatusLabel() +{ +} + +void MyStatusLabel::mousePressEvent(QMouseEvent * event) { + + if (!mousePress && objectName().contains("textLabel_Status0")) { + mousePress = TRUE; + myW->mouseOverFlipCards(TRUE); + + } + + QLabel::mousePressEvent(event); +} + +void MyStatusLabel::mouseReleaseEvent(QMouseEvent * event) { + + if (mousePress && objectName().contains("textLabel_Status0")) { + mousePress = FALSE; + myW->mouseOverFlipCards(FALSE); + } + + QLabel::mouseReleaseEvent(event); +} diff --git a/src/gui/qt/mainwindow/mystatuslabel.h b/src/gui/qt/mainwindow/mystatuslabel.h new file mode 100644 index 00000000..30054de6 --- /dev/null +++ b/src/gui/qt/mainwindow/mystatuslabel.h @@ -0,0 +1,44 @@ +// +// C++ Interface: mycardspixmaplabel +// +// Description: +// +// +// Author: FThauer FHammer , (C) 2007 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef MYSTATUSLABEL_H +#define MYSTATUSLABEL_H + +#include + +#include +#include + +class mainWindowImpl; + +class MyStatusLabel : public QLabel +{ +Q_OBJECT +public: + MyStatusLabel(QFrame*); + + ~MyStatusLabel(); + + + void setMyW ( mainWindowImpl* theValue ) { myW = theValue; } + + void mousePressEvent ( QMouseEvent *); + void mouseReleaseEvent ( QMouseEvent *); + + +private: + + mainWindowImpl *myW; + bool mousePress; + +}; + +#endif