start implementing chancelabel

This commit is contained in:
doitux
2008-10-13 20:03:56 +00:00
parent de53c89fca
commit 1962bfe925
6 changed files with 291 additions and 192 deletions
+6 -6
View File
@@ -184,7 +184,8 @@ HEADERS += \
src/gui/qttoolsinterface.h \
src/gui/qt/qttools/qttoolswrapper.h \
src/gui/qt/qttools/qthelper/qthelper.h \
src/gui/generic/serverguiwrapper.h
src/gui/generic/serverguiwrapper.h \
src/gui/qt/gametable/mychancelabel.h
FORMS += \
src/gui/qt/gametable.ui \
@@ -243,7 +244,8 @@ SOURCES += \
src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp \
src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.cpp \
src/net/common/net_helper_client.cpp \
src/core/common/loghelper_client.cpp
src/core/common/loghelper_client.cpp \
src/gui/qt/gametable/mychancelabel.cpp
TRANSLATIONS = \
ts/pokerth_bg.ts \
@@ -346,13 +348,11 @@ unix: !mac{
}
BOOST_LIBS = $$BOOST_THREAD $$BOOST_FS $$BOOST_IOSTREAMS
!count(BOOST_LIBS, 3){
error("could not locate required library: \
libboost (version >= 1.34.1) --> http://www.boost.org/")
error( libboost (version >= 1.34.1) --> http://www.boost.org/")
}
if($$system(sdl-config --version)){
error("Could not determine if required library is installed: \
libSDL_mixer, libSDL --> http://www.libsdl.org/")
error( libSDL_mixer, libSDL --> http://www.libsdl.org/")
}
UNAME = $$system(uname -s)
+33 -1
View File
@@ -1836,7 +1836,7 @@
</item>
</layout>
</item>
<item row="3" column="0" >
<item row="4" column="0" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
@@ -1849,6 +1849,13 @@
</property>
</spacer>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_votesMonitor" >
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@@ -2645,6 +2652,26 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_Chance" >
<attribute name="title" >
<string>Chance</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2" >
<property name="margin" >
<number>2</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="MyChanceLable" name="label" >
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0" >
@@ -3116,6 +3143,11 @@
<extends>QLabel</extends>
<header>myavatarlabel.h</header>
</customwidget>
<customwidget>
<class>MyChanceLable</class>
<extends>QLabel</extends>
<header>mychancelable.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
+14 -13
View File
@@ -27,6 +27,7 @@
#include "mycardspixmaplabel.h"
#include "mysetlabel.h"
#include "myavatarlabel.h"
#include "mychancelabel.h"
#include "log.h"
#include "chat.h"
@@ -398,6 +399,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
label_timeout->setStyleSheet("QLabel { color: #99D500;}");
label_kickVoteTimeout->setStyleSheet("QLabel { color: #99D500;}");
label_kickUser->setStyleSheet("QLabel { color: #99D500;}");
label_votesMonitor->setStyleSheet("QLabel { color: #99D500;}");
statusbar->setStyleSheet(" QStatusBar { "+ font1String +" font-size: 12px; color: #B7FF00; }");
@@ -2651,7 +2653,9 @@ void gameTableImpl::keyPressEvent ( QKeyEvent * event ) {
}
else { keyUpDownChatCounter = 0; }
//TESTING UNIT
// if (event->key() == Qt::Key_M) { startVoteOnKick(3,60); }
// if (event->key() == Qt::Key_N) { endVoteOnKick(); }
}
void gameTableImpl::changePlayingMode() {
@@ -2686,14 +2690,6 @@ bool gameTableImpl::eventFilter(QObject *obj, QEvent *event)
myChat->nickAutoCompletition();
return true;
}
else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_M) { //TESTING UNIT
startVoteOnKick(3,60);
return true;
}
else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_N) { //TESTING UNIT
stopVoteOnKickTimeout();
return true;
}
else if (event->type() == QEvent::Close) {
event->ignore();
closeGameTable();
@@ -3082,9 +3078,10 @@ void gameTableImpl::startVoteOnKick(int playerId, int timeoutSec)
tabWidget_Left->setCurrentIndex(2);
PlayerInfo info(myStartWindow->getSession()->getClientPlayerInfo(playerId));
label_kickUser->setText(tr("Do you want to kick %1 \nfrom this game?").arg(QString::fromUtf8(info.playerName.c_str())));
label_kickUser->setText(tr("Do you want to kick <b>%1</b> \nfrom this game?").arg(QString::fromUtf8(info.playerName.c_str())));
voteOnKickTimeoutSecs = timeoutSec;
playerAboutToKickId = playerId;
startVoteOnKickTimeout();
}
@@ -3092,8 +3089,7 @@ void gameTableImpl::endVoteOnKick()
{
stopVoteOnKickTimeout();
tabWidget_Left->removeTab(2);
tabWidget_Left->setCurrentIndex(1);
// tabWidget_Left->setCurrentIndex(1);
}
void gameTableImpl::voteOnKickYes()
@@ -3119,7 +3115,12 @@ void gameTableImpl::stopVoteOnKickTimeout()
void gameTableImpl::nextVoteOnKickTimeoutAnimationFrame()
{
qDebug() << voteOnKickTimeoutSecs-voteOnKickRealTimer.elapsed().total_seconds();
label_kickVoteTimeout->setText(tr("%1 secs left").arg(voteOnKickTimeoutSecs-voteOnKickRealTimer.elapsed().total_seconds()));
}
void gameTableImpl::refreshVotesMonitor()
{
PlayerInfo info(myStartWindow->getSession()->getClientPlayerInfo(playerAboutToKickId));
label_votesMonitor->setText(tr("Player <b>%1</b> has %2 votes against him.").arg(QString::fromUtf8(info.playerName.c_str())));
}
+3
View File
@@ -286,6 +286,7 @@ public slots:
void startVoteOnKickTimeout();
void stopVoteOnKickTimeout();
void nextVoteOnKickTimeoutAnimationFrame();
void refreshVotesMonitor();
private:
@@ -402,7 +403,9 @@ private:
int keyUpDownChatCounter;
int myLastPreActionBetValue;
int voteOnKickTimeoutSecs;
int playerAboutToKickId;
// StyleSheetReader *myStyleSheetReader;
friend class GuiWrapper;
+24
View File
@@ -0,0 +1,24 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "mychancelabel.h"
#include "gametableimpl.h"
using namespace std;
MyChanceLabel::MyChanceLabel(QWidget* parent)
: QLabel(parent) {
}
MyChanceLabel::~MyChanceLabel()
{
}
+39
View File
@@ -0,0 +1,39 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MYCHANCELABEL_H
#define MYCHANCELABEL_H
#include <iostream>
#include <QtGui>
#include <QtCore>
class gameTableImpl;
class MyChanceLabel : public QLabel
{
Q_OBJECT
public:
MyChanceLabel(QWidget*);
~MyChanceLabel();
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
private:
gameTableImpl *myW;
};
#endif