start anti-peek feature

This commit is contained in:
doitux
2007-08-19 12:33:24 +00:00
parent f05ccc1469
commit 260182f570
8 changed files with 186 additions and 15 deletions
+3 -1
View File
@@ -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 +=
+7 -2
View File
@@ -1668,7 +1668,7 @@
<height>111</height>
</rect>
</property>
<widget class="QLabel" name="textLabel_Status0" >
<widget class="MyStatusLabel" name="textLabel_Status0" >
<property name="geometry" >
<rect>
<x>9</x>
@@ -6068,7 +6068,7 @@
<x>0</x>
<y>0</y>
<width>1000</width>
<height>30</height>
<height>29</height>
</rect>
</property>
<widget class="QMenu" name="menuView" >
@@ -6182,6 +6182,11 @@
<extends>QTabWidget</extends>
<header>myrighttabwidget.h</header>
</customwidget>
<customwidget>
<class>MyStatusLabel</class>
<extends>QLabel</extends>
<header>mystatuslabel.h</header>
</customwidget>
<customwidget>
<class>MySetLabel</class>
<extends>QLabel</extends>
+15 -1
View File
@@ -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() {
+2
View File
@@ -275,6 +275,8 @@ public slots:
void localGameModification();
void networkGameModification();
void mouseOverFlipCards(bool front);
void quitPokerTH();
+44 -8
View File
@@ -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);
}
+23 -3
View File
@@ -12,9 +12,12 @@
#ifndef MYCARDSPIXMAPLABEL_H
#define MYCARDSPIXMAPLABEL_H
#include <iostream>
#include <QtGui>
#include <QtCore>
#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
+48
View File
@@ -0,0 +1,48 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (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);
}
+44
View File
@@ -0,0 +1,44 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MYSTATUSLABEL_H
#define MYSTATUSLABEL_H
#include <iostream>
#include <QtGui>
#include <QtCore>
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