mainwindow --> gametable

This commit is contained in:
doitux
2008-05-05 07:48:02 +00:00
parent f2defd033d
commit 51038bfe12
20 changed files with 0 additions and 7488 deletions
-110
View File
@@ -1,110 +0,0 @@
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "chat.h"
#include "mainwindowimpl.h"
#include "session.h"
#include "game.h"
#include "playerinterface.h"
#include "chattools.h"
#include "configfile.h"
using namespace std;
#define COMMAND_KICK_STR "/kick "
Chat::Chat(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c)
{
myChatTools = new ChatTools(myW->lineEdit_ChatInput, myConfig, 2, myW->textBrowser_Chat);
}
Chat::~Chat()
{
delete myConfig;
myConfig = 0;
}
void Chat::sendMessage() {
//filter /kick command
if(myW->lineEdit_ChatInput->text().startsWith(COMMAND_KICK_STR)) {
QString playerToKick = myW->lineEdit_ChatInput->text();
playerToKick.remove(0, sizeof(COMMAND_KICK_STR) - 1);
myW->lineEdit_ChatInput->setText("");
if(myW->getSession().getClientGameInfo(myW->getSession().getClientCurrentGameId()).adminPlayerId == myW->getSession().getCurrentGame()->getSeatsList()->front()->getMyUniqueID()) {
if(playerToKick.toUtf8().constData() == myW->getSession().getCurrentGame()->getSeatsList()->front()->getMyName()) {
myW->textBrowser_Chat->append("<span style=\"color:#ff0000;\">"+tr("You cannot kick yourself!")+"</span>");
}
else {
myW->getSession().kickPlayer(playerToKick.toUtf8().constData());
}
}
else {
myW->textBrowser_Chat->append("<span style=\"color:#ff0000;\">"+tr("You cannot kick any player - You are not game admin!")+"</span>");
}
return;
}
fillChatLinesHistory(myW->lineEdit_ChatInput->text());
myW->getSession().sendChatMessage(myW->lineEdit_ChatInput->text().toUtf8().constData());
myW->lineEdit_ChatInput->setText("");
}
void Chat::receiveMessage(QString playerName, QString message) {
myChatTools->receiveMessage(playerName, message);
checkInvisible();
}
void Chat::checkInvisible() {
switch (myW->tabWidget_Left->currentIndex()) {
case 1: { myW->tabWidget_Left->stopBlinkChatTab();
myW->tabWidget_Left->showDefaultChatTab();
}
break;
default: { myW->tabWidget_Left->startBlinkChatTab(); }
}
}
void Chat::checkInputLength(QString string) {
if(string.toUtf8().length() > 120) myW->lineEdit_ChatInput->setMaxLength(string.length());
}
void Chat::clearNewGame() {
myW->textBrowser_Chat->clear();
}
void Chat::setPlayerNicksList(QStringList nickList) {
//fill playerNicksList for nick-autocompletition
myChatTools->setPlayerNicksList(nickList);
}
void Chat::fillChatLinesHistory(QString fillString) { myChatTools->fillChatLinesHistory(fillString); }
int Chat::getChatLinesHistorySize() { return myChatTools->getChatLinesHistorySize(); }
void Chat::showChatHistoryIndex(int index) { myChatTools->showChatHistoryIndex(index); }
void Chat::nickAutoCompletition() { myChatTools->nickAutoCompletition(); }
void Chat::setChatTextEdited() { myChatTools->setChatTextEdited(); }
-67
View File
@@ -1,67 +0,0 @@
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef CHAT_H
#define CHAT_H
#include <string>
#include <QtCore>
class mainWindowImpl;
class ChatTools;
class ConfigFile;
class Chat : public QObject
{
Q_OBJECT
public:
Chat(mainWindowImpl*, ConfigFile *c);
~Chat();
public slots:
void sendMessage();
void receiveMessage(QString playerName, QString msg);
void checkInvisible();
void checkInputLength(QString);
void clearNewGame();
ChatTools* getMyChatTools() const { return myChatTools; }
void fillChatLinesHistory(QString fillString);
void showChatHistoryIndex(int index);
int getChatLinesHistorySize();
void nickAutoCompletition();
void setChatTextEdited();
void setPlayerNicksList(QStringList);
private:
mainWindowImpl *myW;
ConfigFile *myConfig;
ChatTools *myChatTools;
friend class GuiWrapper;
};
#endif
File diff suppressed because it is too large Load Diff
-93
View File
@@ -1,93 +0,0 @@
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef LOG_H
#define LOG_H
#include <string>
#include "configfile.h"
#include <QtCore>
class mainWindowImpl;
class Log : public QObject
{
Q_OBJECT
public:
Log(mainWindowImpl*, ConfigFile *c);
~Log();
public slots:
void logPlayerActionMsg(QString playerName, int action, int setValue);
void logNewGameHandMsg(int gameID, int handID);
void logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName);
void logPlayerWinsMsg(QString playerName, int pot, bool main);
void logPlayerSitsOut(QString playerName);
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
void logFlipHoleCardsMsg(QString playerName, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows");
void logPlayerLeftMsg(QString playerName);
void logNewGameAdminMsg(QString playerName);
void logPlayerWinGame(QString playerName, int gameID);
void flushLogAtGame(int gameID);
void flushLogAtHand();
public:
QStringList translateCardsValueCode(int cardsValueCode);
QStringList translateCardCode(int cardCode);
QString determineHandName(int cardsValueInt);
void writeLogFileStream(QString string);
signals:
void signalLogPlayerActionMsg(QString playerName, int action, int setValue);
void signalLogNewGameHandMsg(int gameID, int handID);
void signalLogNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName);
void signalLogPlayerWinsMsg(QString playerName, int pot, bool main);
void signalLogPlayerSitsOut(QString playerName);
void signalLogDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
void signalLogFlipHoleCardsMsg(QString playerName, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows");
void signalLogPlayerLeftMsg(QString playerName);
void signalLogNewGameAdminMsg(QString playerName);
void signalLogPlayerWinGame(QString playerName, int gameID);
void signalFlushLogAtGame(int gameID);
void signalFlushLogAtHand();
private:
int lastGameID;
mainWindowImpl *myW;
ConfigFile *myConfig;
QTextStream stream;
QDir *myLogDir;
QFile *myLogFile;
QString logFileStreamString;
QString myAppDataPath;
friend class GuiWrapper;
};
#endif
File diff suppressed because it is too large Load Diff
-473
View File
@@ -1,473 +0,0 @@
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef MAINWINDOWIMPL_H
#define MAINWINDOWIMPL_H
#include "ui_mainwindow.h"
#include "game_defs.h"
#include <string>
#include <boost/shared_ptr.hpp>
#include <QtGui>
#include <QtCore>
class Log;
class Chat;
class ConfigFile;
class Session;
class Game;
class GuiInterface;
class BoardInterface;
// class HandInterface;
class PlayerInterface;
class MyCardsPixmapLabel;
class MyAvatarLabel;
class newGameDialogImpl;
class settingsDialogImpl;
class selectAvatarDialogImpl;
class aboutPokerthImpl;
class joinNetworkGameDialogImpl;
class connectToServerDialogImpl;
class createNetworkGameDialogImpl;
class startNetworkGameDialogImpl;
class changeHumanPlayerNameDialogImpl;
class gameLobbyDialogImpl;
class timeoutMsgBoxImpl;
class QColor;
class SDLPlayer;
// class StyleSheetReader;
class mainWindowImpl: public QMainWindow, public Ui::mainWindow {
Q_OBJECT
public:
mainWindowImpl(ConfigFile *c = 0, QMainWindow *parent = 0);
~mainWindowImpl();
Session &getSession();
void setSession(boost::shared_ptr<Session> session);
void setLog(Log* l) { myLog = l; }
SDLPlayer* getMySDLPlayer() const { return mySDLPlayer; }
void setSpeeds();
signals:
void signalInitGui(int speed);
void signalShowClientDialog();
void signalRefreshSet();
void signalRefreshCash();
void signalRefreshAction(int =-1, int=-1);
void signalRefreshChangePlayer();
void signalRefreshPot();
void signalRefreshGroupbox(int =-1, int =-1);
void signalRefreshAll();
void signalRefreshPlayerName();
void signalRefreshButton();
void signalRefreshGameLabels(int);
void signalSetPlayerAvatar(int, QString);
void signalGuiUpdateDone();
void signalMeInAction();
void signalUpdateMyButtonsState();
void signalDisableMyButtons();
void signalStartTimeoutAnimation(int playerId, int timeoutSec);
void signalStopTimeoutAnimation(int playerId);
void signalDealBeRoCards(int myBeRoID);
void signalDealHoleCards();
void signalDealFlopCards0();
void signalDealTurnCards0();
void signalDealRiverCards0();
void signalNextPlayerAnimation();
void signalBeRoAnimation2(int);
void signalPreflopAnimation1();
void signalPreflopAnimation2();
void signalFlopAnimation1();
void signalFlopAnimation2();
void signalTurnAnimation1();
void signalTurnAnimation2();
void signalRiverAnimation1();
void signalRiverAnimation2();
void signalPostRiverAnimation1();
void signalPostRiverRunAnimation1();
void signalFlipHolecardsAllIn();
void signalNextRoundCleanGui();
void signalNetClientConnect(int actionID);
void signalNetClientGameInfo(int actionID);
void signalNetClientError(int errorID, int osErrorID);
void signalNetClientNotification(int notificationId);
void signalNetClientStatsUpdate(ServerStats stats);
void signalNetClientShowTimeoutDialog(int, unsigned);
void signalNetClientRemovedFromGame(int notificationId);
void signalNetServerError(int errorID, int osErrorID);
void signalNetClientSelfJoined(unsigned playerId, QString playerName, int rights);
void signalNetClientPlayerJoined(unsigned playerId, QString playerName, int rights);
void signalNetClientPlayerChanged(unsigned playerId, QString newPlayerName);
void signalNetClientPlayerLeft(unsigned playerId, QString playerName);
void signalNetClientNewGameAdmin(unsigned playerId, QString playerName);
void signalNetClientGameListNew(unsigned gameId);
void signalNetClientGameListRemove(unsigned gameId);
void signalNetClientGameListUpdateMode(unsigned gameId, int mode);
void signalNetClientGameListUpdateAdmin(unsigned gameId, unsigned adminPlayerId);
void signalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId);
void signalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId);
void signalNetClientGameStart(boost::shared_ptr<Game> game);
void signalNetClientChatMsg(QString nickName, QString msg);
void signalIrcConnect(QString server);
void signalIrcSelfJoined(QString nickName, QString channel);
void signalIrcPlayerJoined(QString nickName);
void signalIrcPlayerChanged(QString oldNick, QString newNick);
void signalIrcPlayerKicked(QString nickName, QString byWhom, QString reason);
void signalIrcPlayerLeft(QString nickName);
void signalIrcChatMessage(QString nickName, QString msg);
void signalIrcError(int errorCode);
void signalIrcServerError(int errorCode);
public slots:
void initGui(int speed);
void showClientDialog();
void showNetworkStartDialog();
void showLobbyDialog();
//refresh-Funktionen
void refreshSet();
void refreshCash();
void refreshAction(int =-1, int=-1);
void refreshChangePlayer();
void refreshPot();
void refreshGroupbox(int =-1, int =-1);
void refreshAll();
void refreshPlayerName();
QStringList getPlayerNicksList();
void refreshGameLabels(int);
void refreshButton();
void refreshPlayerAvatar();
void setPlayerAvatar(int myID, QString myAvatar);
void guiUpdateDone();
void waitForGuiUpdateDone();
// Karten-Funktionen
void dealHoleCards();
//Spieler-Funktionen
void provideMyActions(int mode = -1); //mode 0 == called from dealberocards
void meInAction();
void disableMyButtons();
void startTimeoutAnimation(int playerId, int timoutSec);
void stopTimeoutAnimation(int playerId);
void setGameSpeed(const int theValue) { guiGameSpeed = theValue; setSpeeds(); } // Achtung Faktor 10!!!
void callNewGameDialog() ;
void callAboutPokerthDialog();
void callSettingsDialog();
void callCreateNetworkGameDialog();
void callJoinNetworkGameDialog();
void callGameLobbyDialog();
void joinGameLobby();
void pushButtonBetRaiseClicked(bool checked);
void pushButtonCallCheckClicked(bool checked);
void pushButtonFoldClicked(bool checked);
void pushButtonAllInClicked(bool checked);
void myCallCheck();
void myFold();
void myCheck();
int getMyCallAmount();
int getBetRaisePushButtonValue();
int getMyBetAmount();
void myCall();
void mySet();
void myAllIn();
void myActionDone();
void dealBeRoCards(int);
void dealFlopCards0();
void dealFlopCards1();
void dealFlopCards2();
void dealFlopCards3();
void dealFlopCards4();
void dealFlopCards5();
void dealFlopCards6();
void dealTurnCards0();
void dealTurnCards1();
void dealTurnCards2();
void dealRiverCards0();
void dealRiverCards1();
void dealRiverCards2();
void nextPlayerAnimation();
void beRoAnimation2(int);
void preflopAnimation1();
void preflopAnimation1Action();
void preflopAnimation2();
void preflopAnimation2Action();
void flopAnimation1();
void flopAnimation1Action();
void flopAnimation2();
void flopAnimation2Action();
void turnAnimation1();
void turnAnimation1Action();
void turnAnimation2();
void turnAnimation2Action();
void riverAnimation1();
void riverAnimation1Action();
void riverAnimation2();
void riverAnimation2Action();
void postRiverAnimation1();
void postRiverAnimation1Action();
void postRiverRunAnimation1();
void postRiverRunAnimation2();
void postRiverRunAnimation2_flipHoleCards1();
void postRiverRunAnimation2_flipHoleCards2();
void postRiverRunAnimation3();
void postRiverRunAnimation4();
void postRiverRunAnimation5();
void postRiverRunAnimation6();
void blinkingStartButtonAnimationAction();
void flipHolecardsAllIn();
void showMyCards();
void handSwitchRounds();
void startNewHand();
void startNewLocalGame(newGameDialogImpl* =0);
void stopTimer();
void nextRoundCleanGui();
void breakButtonClicked();
void keyPressEvent ( QKeyEvent*);
bool eventFilter(QObject *obj, QEvent *event);
void switchChatWindow();
void switchHelpWindow();
void switchLogWindow();
void switchAwayWindow();
void switchFullscreen();
void paintStartSplash();
void sendChatMessage();
void checkChatInputLength(QString);
void tabSwitchAction();
void leaveCurrentNetworkGame();
void networkError(int, int);
void networkNotification(int);
void networkStart(boost::shared_ptr<Game> game);
// void closeEvent(QCloseEvent*);
void localGameModification();
void networkGameModification();
void mouseOverFlipCards(bool front);
void updateMyButtonsState(int mode = -1); //mode 0 == called from dealberocards
void uncheckMyButtons();
void resetMyButtonsCheckStateMemory();
void clearMyButtons();
void myButtonsCheckable(bool state);
void changePlayingMode();
void changeLineEditBetValue(int);
void lineEditBetValueChanged(QString);
void showMaximized ();
void quitPokerTH();
void showTimeoutDialog(int msgID, unsigned duration);
void hideTimeoutDialog();
// void paintEvent(QPaintEvent *);
private:
boost::shared_ptr<GuiInterface> myServerGuiInterface;
boost::shared_ptr<Session> mySession;
Log *myLog;
Chat *myChat;
ConfigFile *myConfig;
//Timer
QTimer *potDistributeTimer;
QTimer *timer;
QTimer *dealFlopCards0Timer;
QTimer *dealFlopCards1Timer;
QTimer *dealFlopCards2Timer;
QTimer *dealFlopCards3Timer;
QTimer *dealFlopCards4Timer;
QTimer *dealFlopCards5Timer;
QTimer *dealFlopCards6Timer;
QTimer *dealTurnCards0Timer;
QTimer *dealTurnCards1Timer;
QTimer *dealTurnCards2Timer;
QTimer *dealRiverCards0Timer;
QTimer *dealRiverCards1Timer;
QTimer *dealRiverCards2Timer;
QTimer *nextPlayerAnimationTimer;
QTimer *preflopAnimation1Timer;
QTimer *preflopAnimation2Timer;
QTimer *flopAnimation1Timer;
QTimer *flopAnimation2Timer;
QTimer *turnAnimation1Timer;
QTimer *turnAnimation2Timer;
QTimer *riverAnimation1Timer;
QTimer *riverAnimation2Timer;
QTimer *postRiverAnimation1Timer;
QTimer *postRiverRunAnimation1Timer;
QTimer *postRiverRunAnimation2Timer;
QTimer *postRiverRunAnimation2_flipHoleCards1Timer;
QTimer *postRiverRunAnimation2_flipHoleCards2Timer;
QTimer *postRiverRunAnimation3Timer;
QTimer *postRiverRunAnimation5Timer;
QTimer *postRiverRunAnimation6Timer;
QTimer *blinkingStartButtonAnimationTimer;
QWidget *userWidgetsArray[6];
QLabel *buttonLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *cashLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *cashTopLabelArray[MAX_NUMBER_OF_PLAYERS];
MySetLabel *setLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *actionLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS];
MyAvatarLabel *playerAvatarLabelArray[MAX_NUMBER_OF_PLAYERS];
QGroupBox *groupBoxArray[MAX_NUMBER_OF_PLAYERS];
MyCardsPixmapLabel *boardCardsArray[5];
MyCardsPixmapLabel *holeCardsArray[MAX_NUMBER_OF_PLAYERS][2];
QPixmap *flipside;
//Dialoge
aboutPokerthImpl *myAboutPokerthDialog;
newGameDialogImpl *myNewGameDialog;
settingsDialogImpl *mySettingsDialog;
selectAvatarDialogImpl *mySelectAvatarDialog;
changeHumanPlayerNameDialogImpl *myChangeHumanPlayerNameDialog;
joinNetworkGameDialogImpl *myJoinNetworkGameDialog;
connectToServerDialogImpl *myConnectToServerDialog;
startNetworkGameDialogImpl *myStartNetworkGameDialog;
createNetworkGameDialogImpl *myCreateNetworkGameDialog;
gameLobbyDialogImpl *myGameLobbyDialog;
boost::shared_ptr<timeoutMsgBoxImpl> myTimeoutDialog;
//Sound
SDLPlayer *mySDLPlayer;
QString myAppDataPath;
int distributePotAnimCounter;
int playingMode;
QString font2String;
QString font1String;
//Speed
int guiGameSpeed;
int gameSpeed;
int dealCardsSpeed;
int preDealCardsSpeed;
int postDealCardsSpeed;
int AllInDealCardsSpeed;
int postRiverRunAnimationSpeed;
int winnerBlinkSpeed;
int newRoundSpeed;
int nextPlayerSpeed1;
int nextPlayerSpeed2;
int nextPlayerSpeed3;
int preflopNextPlayerSpeed;
int nextOpponentSpeed;
bool myActionIsBet;
bool myActionIsRaise;
bool pushButtonBetRaiseIsChecked;
bool pushButtonCallCheckIsChecked;
bool pushButtonFoldIsChecked;
bool pushButtonAllInIsChecked;
bool myButtonsAreCheckable;
bool breakAfterCurrentHand;
bool currentGameOver;
bool flipHolecardsAllInAlreadyDone;
bool betSliderChangedByInput;
QColor active;
QColor inactive;
QColor highlight;
// statistic testing
int statisticArray[15];
QSemaphore guiUpdateSemaphore;
int keyUpDownChatCounter;
int myLastPreActionBetValue;
// StyleSheetReader *myStyleSheetReader;
friend class GuiWrapper;
};
#endif
-40
View File
@@ -1,40 +0,0 @@
//
// 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;
MyAvatarLabel::MyAvatarLabel(QGroupBox* parent)
: QLabel(parent)
{
myContextMenu = new QMenu;
myContextMenu->addAction(tr("Vote for kick this user"));
}
MyAvatarLabel::~MyAvatarLabel()
{
}
void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent * event ) {
// showContextMenu(event->globalPos());
}
void MyAvatarLabel::showContextMenu(const QPoint &pos) {
// myContextMenu->popup(pos);
}
-45
View File
@@ -1,45 +0,0 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MYAVATARLABEL_H
#define MYAVATARLABEL_H
#include <iostream>
#include <QtGui>
#include <QtCore>
class mainWindowImpl;
class MyAvatarLabel : public QLabel
{
Q_OBJECT
public:
MyAvatarLabel(QGroupBox*);
~MyAvatarLabel();
void setMyW ( mainWindowImpl* theValue ) { myW = theValue; }
void contextMenuEvent ( QContextMenuEvent * event );
public slots:
void showContextMenu(const QPoint &pos);
private:
mainWindowImpl *myW;
QMenu *myContextMenu;
};
#endif
@@ -1,232 +0,0 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "mycardspixmaplabel.h"
#include "mainwindowimpl.h"
// using namespace std;
MyCardsPixmapLabel::MyCardsPixmapLabel(QFrame* parent)
: QLabel(parent), myW(NULL)
{
this->setMouseTracking(TRUE);
fadeOutAction = FALSE;
flipCardsAction1 = FALSE;
flipCardsAction2 = FALSE;
mousePress = FALSE;
fastFlipCardsFront = FALSE;
// rotationIntervall = 0.03;
isFlipside = FALSE;
fadeOutTimer = new QTimer;
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)));
}
MyCardsPixmapLabel::~MyCardsPixmapLabel()
{
}
void MyCardsPixmapLabel::startFadeOut(int speed) {
frameOpacity = 0.0;
if(speed <= 4) { opacityRaiseInterval = 0.01; }
if(speed > 4 && speed <= 7) { opacityRaiseInterval = 0.02; }
if(speed > 7 && speed <= 10) { opacityRaiseInterval = 0.04; }
if(speed != 11) {
fadeOutAction = TRUE;
frameOpacity = 0.0;
fadeOutTimer->start(40);
}
}
void MyCardsPixmapLabel::nextFadeOutFrame() {
if (frameOpacity < 0.75) {
frameOpacity += opacityRaiseInterval;
update();
}
else {
fadeOutTimer->stop();
// fadeOutAction = FALSE;
}
}
void MyCardsPixmapLabel::startFlipCards(int speed, const QPixmap &frontPix, const QPixmap &flipsidePix) {
stopFlipCards = FALSE;
QLabel::setPixmap(frontPix);
frameFlipCardsAction1Size = 1.0;
frameFlipCardsAction2Size = 0.0;
front = frontPix.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);;
flipside = flipsidePix.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);;
if(speed <= 4) { flipCardsScaleIntervall = 0.1; }
if(speed > 4 && speed <= 6) { flipCardsScaleIntervall = 0.20; }
if(speed > 6 && speed <= 8) { flipCardsScaleIntervall = 0.25; }
if(speed > 8 && speed <= 10) { flipCardsScaleIntervall = 0.5; }
//
if(speed != 11) {
flipCardsAction1 = TRUE;
flipCardsTimer->start(40);
}
}
void MyCardsPixmapLabel::stopFlipCardsAnimation() {
flipCardsTimer->stop();
flipCardsAction1 = FALSE;
flipCardsAction2 = FALSE;
stopFlipCards = TRUE;
update();
}
void MyCardsPixmapLabel::nextFlipCardsFrame() {
if (frameFlipCardsAction1Size > 0.1 ) {
//erst flipside verkleinern
frameFlipCardsAction1Size -= flipCardsScaleIntervall;
update();
}
else {
if(flipCardsAction1) {
flipCardsAction1 = FALSE;
flipCardsAction2 = TRUE;
}
else {
//dann front vergrößern
if (frameFlipCardsAction2Size < 0.9 ) {
frameFlipCardsAction2Size += flipCardsScaleIntervall;
update();
}
else {
flipCardsAction2 = FALSE;
flipCardsTimer->stop();
}
}
}
}
void MyCardsPixmapLabel::setPixmap(const QPixmap &pic, const bool flipsideIs) {
QLabel::setPixmap(pic);
isFlipside = flipsideIs;
}
void MyCardsPixmapLabel::setFrontPixmap ( const QPixmap &pic ) {
myHiddenFront = pic.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);;
}
void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) {
if (!(flipCardsAction1 || flipCardsAction2)) {
QLabel::paintEvent(event);
}
if (fadeOutAction) {
QPainter painter(this);
// painter.setPen(QColor(74,131,83));
painter.setBrush(QColor(74,131,83));
// painter.setBrush(palette().color(QPalette::Background));
// painter.setBrush(QColor(0,0,0));
painter.setOpacity(frameOpacity);
// painter.drawRect(this->geometry());
if(objectName().contains("pixmapLabel_cardBoard"))
painter.drawRect(-1,-1,80,115);
else
painter.drawRect(-1,-1,81,112);
}
if (flipCardsAction1) {
QPainter painter2(this);
QPointF center(flipside.width()/2.0, flipside.height()/2.0);
painter2.translate(center);
painter2.scale(frameFlipCardsAction1Size ,1);
painter2.translate(-center);
painter2.drawPixmap(0,0, flipside);
}
if (flipCardsAction2) {
QPainter painter3(this);
QPointF center(front.width()/2.0, front.height()/2.0);
painter3.translate(center);
painter3.scale(frameFlipCardsAction2Size ,1);
painter3.translate(-center);
painter3.drawPixmap(0,0, front);
}
if (fastFlipCardsFront && !fadeOutAction && !flipCardsAction1 && !flipCardsAction2) {
if(objectName().contains("pixmapLabel_card0")) {
QPainter painter4(this);
painter4.drawPixmap(0,0, myHiddenFront);
}
}
}
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);
}
@@ -1,93 +0,0 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MYCARDSPIXMAPLABEL_H
#define MYCARDSPIXMAPLABEL_H
#include <iostream>
#include <QtGui>
#include <QtCore>
class mainWindowImpl;
class MyCardsPixmapLabel : public QLabel
{
Q_OBJECT
public:
MyCardsPixmapLabel(QFrame*);
~MyCardsPixmapLabel();
void setMyW ( mainWindowImpl* theValue ) { myW = theValue; }
void setIsFlipside(bool theValue){ isFlipside = theValue;}
bool getIsFlipside() const{ return isFlipside;}
void setFadeOutAction(bool theValue) { fadeOutAction = theValue; }
bool getFadeOutAction() const { return fadeOutAction;}
void startFadeOut(int);
void startFlipCards(int, const QPixmap & , const QPixmap &);
void stopFlipCardsAnimation();
void paintEvent(QPaintEvent * event);
signals:
void signalFastFlipCards(bool);
public slots:
void setPixmap ( const QPixmap &, const bool );
void setFrontPixmap ( const QPixmap &);
void nextFadeOutFrame();
void nextFlipCardsFrame();
void fastFlipCards(bool front);
// void mouseMoveEvent ( QMouseEvent *);
void mousePressEvent ( QMouseEvent *);
void mouseReleaseEvent ( QMouseEvent *);
private:
mainWindowImpl* myW;
qreal frameOpacity;
qreal opacityRaiseInterval;
qreal flipCardsScaleIntervall;
qreal frameFlipCardsAction1Size;
qreal frameFlipCardsAction2Size;
QTimer *fadeOutTimer;
QTimer *flipCardsTimer;
bool isFlipside;
bool fadeOutAction;
bool flipCardsAction1;
bool flipCardsAction2;
bool stopFlipCards;
bool mousePress;
bool fastFlipCardsFront;
QPixmap front;
QPixmap flipside;
QPixmap myHiddenFront;
friend class mainWindowImpl;
};
#endif
-73
View File
@@ -1,73 +0,0 @@
//
// C++ Implementation: MyLeftTabWidget
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "mylefttabwidget.h"
// using namespace std;
MyLeftTabWidget::MyLeftTabWidget(QGroupBox *parent)
: QTabWidget(parent), chatBlinkTimer(0), myTabBar(0)
{
// fadeOutTimer = new QTimer;
// connect(flipCardsTimer, SIGNAL(timeout()), this, SLOT(nextFlipCardsFrame()));
myTabBar = this->tabBar();
chatBlinkTimer = new QTimer;
connect(chatBlinkTimer, SIGNAL(timeout()), this, SLOT( blinkChatTab() ));
this->setStyleSheet("QTabWidget::pane { border: 2px solid #286400; border-radius: 2px; background-color: #145300; } QTabWidget::tab-bar { left: 5px; } ");
#ifdef _WIN32
QString font1String("font-family: \"Arial\";");
int paddingTop = 1;
int paddingSide = 7;
#else
#ifdef __APPLE__
QString font1String("font-family: \"Lucida Grande\";");
int paddingTop = 1;
int paddingSide = 9;
#else
QString font1String("font-family: \"Nimbus Sans L\";");
int paddingTop = 0;
int paddingSide = 9;
#endif
#endif
QTabBar *myTabBar = this->tabBar();
myTabBar->setStyleSheet("QTabBar::tab{ "+ font1String +" font-size: 11px; color: #99D500; background-color: #145300; border: 2px solid #286400; border-bottom-color: #286400; border-top-left-radius: 4px; border-top-right-radius: 4px; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:selected, QTabBar::tab:hover { background-color: #145300; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:selected { border-color: #286400; border-bottom-color: #145300; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:!selected { margin-top: 2px; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:selected { margin-left: -4px; margin-right: -4px; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:first:selected { margin-left: 0; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:last:selected { margin-right: 0; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:only-one { margin: 0; } QTabBar::tab:disabled { font-size: 11px; font-weight: 900; color: #144D03; background-color: #144D03; border-left-color: #255704; border-right-color: #255704; border-top-color: #255704; }");
}
MyLeftTabWidget::~MyLeftTabWidget()
{
}
void MyLeftTabWidget::startBlinkChatTab() { chatBlinkTimer->start(500); }
void MyLeftTabWidget::stopBlinkChatTab() { chatBlinkTimer->stop(); }
void MyLeftTabWidget::showDefaultChatTab() { myTabBar->setTabTextColor(1, QColor(240,240,240)); }
void MyLeftTabWidget::disableTab(int tabIndex, bool yesNo) { myTabBar->setTabEnabled(tabIndex, !yesNo); }
void MyLeftTabWidget::blinkChatTab() {
if(myTabBar->tabTextColor(1).red() == 240) myTabBar->setTabTextColor(1, QColor(113,162,0));
else myTabBar->setTabTextColor(1, QColor(240,240,240));
}
void MyLeftTabWidget::paintEvent(QPaintEvent * event) {
QTabWidget::paintEvent(event);
}
-45
View File
@@ -1,45 +0,0 @@
//
// C++ Interface: MyLeftTabWidget
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MYLEFTTABWIDGET_H
#define MYLEFTTABWIDGET_H
#include <QtGui>
#include <QtCore>
class MyLeftTabWidget : public QTabWidget
{
Q_OBJECT
public:
MyLeftTabWidget(QGroupBox*);
~MyLeftTabWidget();
void paintEvent(QPaintEvent * event);
void startBlinkChatTab();
void stopBlinkChatTab();
void showDefaultChatTab();
void disableTab(int tabIndex, bool yesNO);
public slots:
void blinkChatTab();
private:
QTimer *chatBlinkTimer;
QTabBar *myTabBar;
};
#endif
@@ -1,72 +0,0 @@
//
// C++ Implementation: MyRightTabWidget
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "myrighttabwidget.h"
#include <iostream>
using namespace std;
MyRightTabWidget::MyRightTabWidget(QGroupBox *parent)
: QTabWidget(parent), myTabBar(0)
{
// fadeOutTimer = new QTimer;
// connect(flipCardsTimer, SIGNAL(timeout()), this, SLOT(nextFlipCardsFrame()));
myTabBar = this->tabBar();
// chatBlinkTimer = new QTimer;
// connect(chatBlinkTimer, SIGNAL(timeout()), this, SLOT( blinkChatTab() ));
this->setStyleSheet("QTabWidget::pane { border: 2px solid #286400; border-radius: 2px; background-color: #145300; } QTabWidget::tab-bar { left: 5px; } ");
#ifdef _WIN32
QString font1String("font-family: \"Arial\";");
int paddingTop = 1;
int paddingSide = 7;
#else
#ifdef __APPLE__
QString font1String("font-family: \"Lucida Grande\";");
int paddingTop = 1;
int paddingSide = 9;
#else
QString font1String("font-family: \"Nimbus Sans L\";");
int paddingTop = 0;
int paddingSide = 9;
#endif
#endif
QTabBar *myTabBar = this->tabBar();
myTabBar->setStyleSheet("QTabBar::tab{ "+ font1String +" font-size: 11px; color: #99D500; background-color: #145300; border: 2px solid #286400; border-bottom-color: #286400; border-top-left-radius: 4px; border-top-right-radius: 4px; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:selected, QTabBar::tab:hover { background-color: #145300; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:selected { border-color: #286400; border-bottom-color: #145300; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:!selected { margin-top: 2px; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:selected { margin-left: -4px; margin-right: -4px; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:first:selected { margin-left: 0; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:last:selected { margin-right: 0; padding-top: "+QString::number(paddingTop,10)+"px; padding-left:"+QString::number(paddingSide,10)+"px; padding-right:"+QString::number(paddingSide,10)+"px;} QTabBar::tab:only-one { margin: 0; } QTabBar::tab:disabled { font-size: 11px; font-weight: 900; color: #144D03; background-color: #144D03; border-left-color: #255704; border-right-color: #255704; border-top-color: #255704; }");
}
MyRightTabWidget::~MyRightTabWidget()
{
}
// // void MyRightTabWidget::startBlinkChatTab() { chatBlinkTimer->start(500); }
// void MyRightTabWidget::stopBlinkChatTab() { chatBlinkTimer->stop(); }
// void MyRightTabWidget::showDefaultChatTab() { myTabBar->setTabTextColor(1, QColor(240,240,240)); }
// void MyRightTabWidget::blinkChatTab() {
//
// if(myTabBar->tabTextColor(1).red() == 240) myTabBar->setTabTextColor(1, QColor(113,162,0));
// else myTabBar->setTabTextColor(1, QColor(240,240,240));
// }
void MyRightTabWidget::paintEvent(QPaintEvent * event) {
QTabWidget::paintEvent(event);
}
-43
View File
@@ -1,43 +0,0 @@
//
// C++ Interface: MyRightTabWidget
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MYRIGHTTABWIDGET_H
#define MYRIGHTTABWIDGET_H
#include <QtGui>
#include <QtCore>
class MyRightTabWidget : public QTabWidget
{
Q_OBJECT
public:
MyRightTabWidget(QGroupBox*);
~MyRightTabWidget();
void paintEvent(QPaintEvent * event);
// void startBlinkChatTab();
// void stopBlinkChatTab();
// void showDefaultChatTab();
public slots:
// void blinkChatTab();
private:
// QTimer *chatBlinkTimer;
QTabBar *myTabBar;
};
#endif
-127
View File
@@ -1,127 +0,0 @@
//
// 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;
MySetLabel::MySetLabel(QGroupBox* parent)
: QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0), waitFrames(0), timerIntervall(0), isBeep(0), isBeepPlayed(0)
{
timeOutAnimationTimer = new QTimer;
connect(timeOutAnimationTimer, SIGNAL(timeout()), this, SLOT(nextTimeOutAnimationFrame()));
}
MySetLabel::~MySetLabel()
{
}
void MySetLabel::startTimeOutAnimation(int secs, bool beep) {
isBeepPlayed = FALSE;
isBeep = beep;
timeOutValue = secs;
timeOutFrame = 1;
timeOutAnimationWidth = 118;
int preTimerIntervall = ((timeOutValue-3) * 1000)/timeOutAnimationWidth;
timerIntervall = preTimerIntervall;
//save gfx ressources and never play more the 10 pps
while(timerIntervall < 100) {
if(secs <= 9 && secs >= 6) {
//fix inaccuracies caused by integer division
timerIntervall = timerIntervall + preTimerIntervall + 5;
}
else {
timerIntervall = timerIntervall + preTimerIntervall;
}
}
waitFrames = 3000/timerIntervall;
//start the real timer
realTimer.reset();
realTimer.start();
// std::cout << timerIntervall << endl;
timeOutAnimation = TRUE;
timeOutAnimationTimer->start(timerIntervall);
}
void MySetLabel::startTimeOutAnimationNow() {
timeOutAnimation = TRUE;
timeOutAnimationTimer->start(83);
}
void MySetLabel::stopTimeOutAnimation() {
// timeOutAnimationKickOnTimer->stop();
timeOutAnimationTimer->stop();
timeOutAnimation = FALSE;
update();
}
void MySetLabel::nextTimeOutAnimationFrame() {
if(timeOutAnimationWidth >=0) {
if(timeOutFrame > waitFrames) {
//play beep after waitFrames one time
if(isBeep && !isBeepPlayed) {
myW->getMySDLPlayer()->playSound("yourturn",0);
isBeepPlayed = TRUE;
}
//save gfx ressources and never play more the 10 pps
unsigned int realTimerValue = realTimer.elapsed().total_milliseconds();
timeOutAnimationWidth = 118-(((realTimerValue-3000)*118)/((timeOutValue-3)*1000));
}
timeOutFrame++;
update();
}
else {
stopTimeOutAnimation();
// no callback is called here.
// the server initiates any action required.
}
}
void MySetLabel::paintEvent(QPaintEvent * event) {
if(!timeOutAnimation || timeOutFrame <= waitFrames) {
QLabel::paintEvent(event);
}
if(timeOutAnimation && timeOutFrame > waitFrames) {
QPainter painter(this);
QLinearGradient linearGrad(QPointF(0, 10), QPointF(113, 10));
linearGrad.setColorAt(0, Qt::red);
linearGrad.setColorAt(0.5, Qt::yellow);
linearGrad.setColorAt(1, Qt::green);
painter.setBrush(linearGrad);
painter.setPen(QColor(0,0,0));
painter.drawRect(0,6,timeOutAnimationWidth-1,8);
}
}
-70
View File
@@ -1,70 +0,0 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MYSETLABEL_H
#define MYSETLABEL_H
#include <iostream>
#include <QtGui>
#include <QtCore>
#include <third_party/boost/timers.hpp>
#include "sdlplayer.h"
class mainWindowImpl;
class MySetLabel : public QLabel
{
Q_OBJECT
public:
MySetLabel(QGroupBox*);
~MySetLabel();
void setMyW ( mainWindowImpl* theValue ) { myW = theValue; }
void startTimeOutAnimation(int secs, bool beep);
void stopTimeOutAnimation();
void paintEvent(QPaintEvent * event);
public slots:
void startTimeOutAnimationNow();
void nextTimeOutAnimationFrame();
private:
mainWindowImpl *myW;
QTimer *timeOutAnimationTimer;
QTimer *timeOutAnimationKickOnTimer;
// boost::shared_ptr<SDLPlayer> mySDLPlayer;
boost::timers::portable::microsec_timer realTimer;
bool timeOutAnimation;
int timeOutAnimationWidth;
int timeOutValue;
int timeOutFrame;
int waitFrames;
int decreaseWidthIntervall;
int timerIntervall;
bool isBeep;
bool isBeepPlayed;
};
#endif
-48
View File
@@ -1,48 +0,0 @@
//
// 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
@@ -1,44 +0,0 @@
//
// 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
@@ -1,282 +0,0 @@
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "startsplash.h"
#include "configfile.h"
#include "mainwindowimpl.h"
StartSplash::StartSplash(mainWindowImpl *parent, ConfigFile *c)
: QSplashScreen(parent), myW(parent), myConfig(c)
{
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
logo = myAppDataPath+"gfx/gui/misc/logoChip3D.png";
frameNo = 52;
opacityCounter = 13;
opacity = 1.0;
QTimer *timer = new QTimer;
connect(timer, SIGNAL(timeout()), this, SLOT(nextAnimationFrame()));
timer->start(40);
}
StartSplash::~StartSplash()
{
}
void StartSplash::nextAnimationFrame() {
++frameNo;
update();
}
void StartSplash::paintEvent(QPaintEvent * /*event*/) {
QPainter painter(this);
#ifdef _WIN32
QFont welcomeFont;
welcomeFont.setFamily("Times New Roman");
welcomeFont.setPixelSize(42);
#else
#ifdef __APPLE__
QFont welcomeFont;
welcomeFont.setFamily("Century Schoolbook L");
welcomeFont.setPixelSize(42);
#else
QFont welcomeFont;
welcomeFont.setFamily("Century Schoolbook L");
welcomeFont.setPixelSize(35);
#endif
#endif
#ifdef __APPLE__
QFont haveFont;
haveFont.setFamily("Century Schoolbook L");
haveFont.setPixelSize(24);
#else
QFont haveFont;
haveFont.setFamily("Century Schoolbook L");
haveFont.setPixelSize(24);
#endif
QFont versionFont;
versionFont.setFamily("Nimbus Sans L");
versionFont.setPixelSize(12);
if(frameNo >= 52 && frameNo < 55) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
}
if(frameNo >= 55 && frameNo < 57) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"W");
}
if(frameNo >= 57 && frameNo < 59) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"We");
}
if(frameNo >= 59 && frameNo < 61) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Wel");
}
if(frameNo >= 61 && frameNo < 63) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welc");
}
if(frameNo >= 63 && frameNo < 65) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welco");
}
if(frameNo >= 65 && frameNo < 67) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcom");
}
if(frameNo >= 67 && frameNo < 72) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome");
}
if(frameNo >= 72 && frameNo < 74) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome t");
}
if(frameNo >= 74 && frameNo < 79 ) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome to");
}
if(frameNo >= 79 && frameNo < 91) {
//
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome to");
--opacityCounter;
// std::cout << opacity << " " << opacityCounter << "\n";
opacity = 1.0/opacityCounter;
// std::cout << opacity << "\n";
painter.setOpacity(opacity);
painter.drawPixmap(150,85,100,100,logo);
}
if(frameNo >= 91 && frameNo < 106) {
//
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome to");
painter.drawPixmap(150,85,100,100,logo);
}
if(frameNo >= 106 && frameNo < 136) {
//
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome to");
painter.drawPixmap(150,85,100,100,logo);
painter.setFont(haveFont);
painter.setPen(QColor(255,255,255));
painter.drawText(3,190,390,40,4,"Have a lot of fun!");
}
if(frameNo >= 136 && frameNo < 190) {
//
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome to");
painter.drawPixmap(150,85,100,100,logo);
painter.setFont(haveFont);
painter.setPen(QColor(255,255,255));
painter.drawText(3,190,390,40,4,"Have a lot of fun! ;-)");
}
//even draw version number
painter.setOpacity(1.0);
painter.setFont(versionFont);
painter.setPen(QColor(153,213,0));
painter.drawText(309,227,100,20,4,QString("Version %1").arg(POKERTH_BETA_RELEASE_STRING));
painter.setOpacity(opacity);
if(frameNo >=190) {
this->close();
}
}
@@ -1,47 +0,0 @@
//
// C++ Interface: startsplash
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef STARTSPLASH_H
#define STARTSPLASH_H
#include <QtGui>
#include <QtCore>
class mainWindowImpl;
class ConfigFile;
class StartSplash : public QSplashScreen
{
Q_OBJECT
public:
StartSplash(mainWindowImpl *, ConfigFile*);
~StartSplash();
int frameNo;
int opacityCounter;
qreal opacity;
void paintEvent(QPaintEvent * event);
public slots:
void nextAnimationFrame();
private:
mainWindowImpl *myW;
QString myAppDataPath;
QPixmap logo;
ConfigFile *myConfig;
};
#endif