implements "disabling call button after raise" (#35)

This commit is contained in:
doitux
2012-01-22 17:21:05 +00:00
parent 9c8c1122d9
commit ffeeaa6439
6 changed files with 133 additions and 37 deletions
+20 -5
View File
@@ -168,6 +168,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
blinkingStartButtonAnimationTimer = new QTimer(this);
voteOnKickTimeoutTimer = new QTimer(this);
enableCallCheckPushButtonTimer = new QTimer(this);
dealFlopCards0Timer->setSingleShot(TRUE);
dealFlopCards1Timer->setSingleShot(TRUE);
@@ -200,6 +201,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
postRiverRunAnimation5Timer->setSingleShot(TRUE);
postRiverRunAnimation6Timer->setSingleShot(TRUE);
enableCallCheckPushButtonTimer->setSingleShot(TRUE);
playerStarsArray[1][0]=label_Star10;
playerStarsArray[2][0]=label_Star20;
@@ -512,6 +514,8 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
connect(blinkingStartButtonAnimationTimer, SIGNAL(timeout()), this, SLOT( blinkingStartButtonAnimationAction()));
connect(voteOnKickTimeoutTimer, SIGNAL(timeout()), this, SLOT(nextVoteOnKickTimeoutAnimationFrame()));
connect(enableCallCheckPushButtonTimer, SIGNAL(timeout()), this, SLOT(enableCallCheckPushButton()));
connect( actionConfigure_PokerTH, SIGNAL( triggered() ), this, SLOT( callSettingsDialog() ) );
connect( actionClose, SIGNAL( triggered() ), this, SLOT( closeGameTable()) );
@@ -1644,12 +1648,18 @@ void gameTableImpl::provideMyActions(int mode)
}
}
//if text changed on checked button --> uncheck to prevent unwanted actions
if((pushButtonCallCheckString != lastPushButtonCallCheckString && pushButton_CallCheck->isChecked())) {
//if text changed on checked button --> do something to prevent unwanted actions
if(pushButtonCallCheckString != lastPushButtonCallCheckString) {
if(pushButton_CallCheck->isChecked()) {
//uncheck a previous checked button to prevent unwanted action
uncheckMyButtons();
resetMyButtonsCheckStateMemory();
}
//disable button to prevent unwanted clicks (e.g. call allin)
pushButton_CallCheck->setEatMyEvents(true);
enableCallCheckPushButtonTimer->start(1000);
// cout << "jo" << endl;
uncheckMyButtons();
resetMyButtonsCheckStateMemory();
}
if(pushButtonBetRaiseString == "") {
@@ -3853,3 +3863,8 @@ void gameTableImpl::soundEvent_blindsWereSet(int sbSet)
{
mySoundEventHandler->blindsWereSet(sbSet);
}
void gameTableImpl::enableCallCheckPushButton()
{
pushButton_CallCheck->setEatMyEvents(false);
}
+2
View File
@@ -338,6 +338,7 @@ public slots:
void closeMessageBoxes();
void hide();
void soundEvent_blindsWereSet(int);
void enableCallCheckPushButton();
private:
@@ -385,6 +386,7 @@ private:
QTimer *blinkingStartButtonAnimationTimer;
QTimer *voteOnKickTimeoutTimer;
boost::timers::portable::microsec_timer voteOnKickRealTimer;
QTimer *enableCallCheckPushButtonTimer;
QWidget *userWidgetsArray[6];
QLabel *buttonLabelArray[MAX_NUMBER_OF_PLAYERS];
+9 -1
View File
@@ -21,7 +21,7 @@
using namespace std;
MyActionButton::MyActionButton(QGroupBox* parent)
: QPushButton(parent), myStyle(NULL)
: QPushButton(parent), myStyle(NULL), eatMyEvents(false)
{
}
@@ -50,3 +50,11 @@ void MyActionButton::paintEvent(QPaintEvent * event)
painter.drawText(8,15,15,15,Qt::AlignLeft,fKeyText);
}
}
bool MyActionButton::event(QEvent *event)
{
if ((event->type() == QEvent::KeyPress || event->type() == QEvent::MouseButtonPress) && eatMyEvents ) {
return true;
}
return QWidget::event(event);
}
+4
View File
@@ -39,10 +39,14 @@ public:
myStyle = theValue;
}
void setEatMyEvents(bool e) { eatMyEvents = e; }
bool event(QEvent *e);
private:
QString fKeyText;
GameTableStyleReader *myStyle;
bool eatMyEvents;
};
#endif