Reformatting code using Kernighan & Ritchie style, tabs, tab width=4.

Command line: astyle --style=kr --indent=force-tab=4 --lineend=linux -n -r <file names>
This commit is contained in:
lotodore
2011-02-11 20:02:08 +00:00
parent 29dca1846e
commit 02518c67b2
232 changed files with 22743 additions and 21044 deletions
File diff suppressed because it is too large Load Diff
+384 -366
View File
@@ -51,407 +51,425 @@ class CardDeckStyleReader;
class SDLPlayer;
class gameTableImpl: public QMainWindow, public Ui::gameTable {
Q_OBJECT
class gameTableImpl: public QMainWindow, public Ui::gameTable
{
Q_OBJECT
public:
gameTableImpl(ConfigFile *c = 0, QMainWindow *parent = 0);
gameTableImpl(ConfigFile *c = 0, QMainWindow *parent = 0);
~gameTableImpl();
~gameTableImpl();
boost::shared_ptr<Session> getSession();
SDLPlayer* getMySDLPlayer() const { return mySDLPlayer; }
ChatTools* getMyChat() const { return myChat; }
ConfigFile* getMyConfig() const { return myConfig; }
GameTableStyleReader* getMyGameTableStyle() const { return myGameTableStyle; }
bool getGuestMode() const { return guestMode; }
boost::shared_ptr<Session> getSession();
SDLPlayer* getMySDLPlayer() const {
return mySDLPlayer;
}
ChatTools* getMyChat() const {
return myChat;
}
ConfigFile* getMyConfig() const {
return myConfig;
}
GameTableStyleReader* getMyGameTableStyle() const {
return myGameTableStyle;
}
bool getGuestMode() const {
return guestMode;
}
void setStartWindow(startWindowImpl* s) { myStartWindow = s; }
void setGuiLog(guiLog* l) { myGuiLog = l; }
void setStartWindow(startWindowImpl* s) {
myStartWindow = s;
}
void setGuiLog(guiLog* l) {
myGuiLog = l;
}
void setSpeeds();
void setSpeeds();
signals:
void signalInitGui(int speed);
void signalInitGui(int speed);
void signalShowClientDialog();
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 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 signalSetPlayerAvatar(int, QString);
void signalGuiUpdateDone();
void signalMeInAction();
void signalUpdateMyButtonsState();
void signalDisableMyButtons();
void signalStartTimeoutAnimation(int playerId, int timeoutSec);
void signalStopTimeoutAnimation(int playerId);
void signalMeInAction();
void signalUpdateMyButtonsState();
void signalDisableMyButtons();
void signalStartTimeoutAnimation(int playerId, int timeoutSec);
void signalStopTimeoutAnimation(int playerId);
void signalDealBeRoCards(int myBeRoID);
void signalDealBeRoCards(int myBeRoID);
void signalDealHoleCards();
void signalDealFlopCards0();
void signalDealTurnCards0();
void signalDealRiverCards0();
void signalDealHoleCards();
void signalDealFlopCards0();
void signalDealTurnCards0();
void signalDealRiverCards0();
void signalNextPlayerAnimation();
void signalNextPlayerAnimation();
void signalBeRoAnimation2(int);
void signalBeRoAnimation2(int);
void signalPreflopAnimation1();
void signalPreflopAnimation2();
void signalFlopAnimation1();
void signalFlopAnimation2();
void signalTurnAnimation1();
void signalTurnAnimation2();
void signalRiverAnimation1();
void signalRiverAnimation2();
void signalPostRiverAnimation1();
void signalPostRiverRunAnimation1();
void signalPostRiverShowCards(unsigned playerId);
void signalPreflopAnimation1();
void signalPreflopAnimation2();
void signalFlopAnimation1();
void signalFlopAnimation2();
void signalTurnAnimation1();
void signalTurnAnimation2();
void signalRiverAnimation1();
void signalRiverAnimation2();
void signalPostRiverAnimation1();
void signalPostRiverRunAnimation1();
void signalPostRiverShowCards(unsigned playerId);
void signalFlipHolecardsAllIn();
void signalNextRoundCleanGui();
void signalStartVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick);
void signalChangeVoteOnKickButtonsState(bool showHide);
void signalEndVoteOnKick();
void signalNetClientPlayerLeft(unsigned playerId);
void signalWarningAutoFoldInRankingGame(unsigned remainingAutoFolds);
void signalFlipHolecardsAllIn();
void signalNextRoundCleanGui();
void signalStartVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick);
void signalChangeVoteOnKickButtonsState(bool showHide);
void signalEndVoteOnKick();
void signalNetClientPlayerLeft(unsigned playerId);
void signalWarningAutoFoldInRankingGame(unsigned remainingAutoFolds);
public slots:
void initGui(int speed);
//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();
void refreshGameLabels(int);
void refreshButton();
void refreshPlayerAvatar();
void refreshActionButtonFKeyIndicator(bool =0);
void setPlayerAvatar(int myID, QString myAvatar);
void guiUpdateDone();
void waitForGuiUpdateDone();
void initGui(int speed);
//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();
void refreshGameLabels(int);
void refreshButton();
void refreshPlayerAvatar();
void refreshActionButtonFKeyIndicator(bool =0);
void setPlayerAvatar(int myID, QString myAvatar);
void guiUpdateDone();
void waitForGuiUpdateDone();
// Karten-Funktionen
void dealHoleCards();
// 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);
//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; // Achtung Faktor 10!!!
setSpeeds();
}
void setGameSpeed(const int theValue) { guiGameSpeed = theValue; setSpeeds(); } // Achtung Faktor 10!!!
void callSettingsDialog();
void applySettings(settingsDialogImpl*);
void callSettingsDialog();
void applySettings(settingsDialogImpl*);
void pushButtonBetRaiseClicked(bool checked);
void pushButtonCallCheckClicked(bool checked);
void pushButtonFoldClicked(bool checked);
void pushButtonAllInClicked(bool checked);
void pushButtonBetRaiseClicked(bool checked);
void pushButtonCallCheckClicked(bool checked);
void pushButtonFoldClicked(bool checked);
void pushButtonAllInClicked(bool checked);
void myCallCheck();
void myCallCheck();
void myFold();
void myCheck();
int getMyCallAmount();
int getBetRaisePushButtonValue();
int getMyBetAmount();
void myCall();
void mySet();
void myAllIn();
void myFold();
void myCheck();
int getMyCallAmount();
int getBetRaisePushButtonValue();
int getMyBetAmount();
void myCall();
void mySet();
void myAllIn();
void myActionDone();
void myActionDone();
void dealBeRoCards(int);
void dealBeRoCards(int);
void dealFlopCards0();
void dealFlopCards1();
void dealFlopCards2();
void dealFlopCards3();
void dealFlopCards4();
void dealFlopCards5();
void dealFlopCards6();
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 dealTurnCards0();
void dealTurnCards1();
void dealTurnCards2();
void flopAnimation1();
void flopAnimation1Action();
void flopAnimation2();
void flopAnimation2Action();
void dealRiverCards0();
void dealRiverCards1();
void dealRiverCards2();
void turnAnimation1();
void turnAnimation1Action();
void turnAnimation2();
void turnAnimation2Action();
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 postRiverRunAnimation3();
void postRiverRunAnimation4();
void postRiverRunAnimation5();
void postRiverRunAnimation6();
void showHoleCards(unsigned playerId, bool allIn = false);
void refreshCardsChance(GameState);
void blinkingStartButtonAnimationAction();
void flipHolecardsAllIn();
void triggerVoteOnKick(int id);
void handSwitchRounds();
void startNewHand();
void stopTimer();
void nextRoundCleanGui();
void breakButtonClicked();
void keyPressEvent ( QKeyEvent*);
bool eventFilter(QObject *obj, QEvent *event);
void switchChatWindow();
void switchHelpWindow();
void switchLogWindow();
void switchAwayWindow();
void switchChanceWindow();
void switchFullscreen();
void sendChatMessage();
void checkChatInputLength(QString);
void tabSwitchAction();
void leaveCurrentNetworkGame();
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 changeSpinBoxBetValue(int);
void spinBoxBetValueChanged(int);
void showMaximized ();
void closeGameTable();
void startVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick);
void changeVoteOnKickButtonsState(bool showHide);
void endVoteOnKick();
void voteOnKickYes();
void voteOnKickNo();
void startVoteOnKickTimeout();
void stopVoteOnKickTimeout();
void nextVoteOnKickTimeoutAnimationFrame();
void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick);
void refreshGameTableStyle();
void saveGameTableGeometry();
void restoreGameTableGeometry();
void netClientPlayerLeft(unsigned playerId);
void registeredUserMode();
void guestUserMode();
void showShowMyCardsButton();
void sendShowMyCardsSignal();
void showWarningAutoFoldInRankingGame(unsigned);
void closeMessageBoxes();
private:
boost::shared_ptr<GuiInterface> myServerGuiInterface;
guiLog *myGuiLog;
ChatTools *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;
QTimer *voteOnKickTimeoutTimer;
boost::timers::portable::microsec_timer voteOnKickRealTimer;
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];
MyNameLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS];
MyAvatarLabel *playerAvatarLabelArray[MAX_NUMBER_OF_PLAYERS];
MyTimeoutLabel *timeoutLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *playerStarsArray[6][MAX_NUMBER_OF_PLAYERS];
QGroupBox *groupBoxArray[MAX_NUMBER_OF_PLAYERS];
MyCardsPixmapLabel *boardCardsArray[5];
MyCardsPixmapLabel *holeCardsArray[MAX_NUMBER_OF_PLAYERS][2];
QLabel *playerTipLabelArray[MAX_NUMBER_OF_PLAYERS];
QPixmap flipside;
// Dialogs
startWindowImpl *myStartWindow;
myMessageDialogImpl *myUniversalMessageDialog;
//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;
bool guestMode;
// statistic testing
int statisticArray[15];
QSemaphore guiUpdateSemaphore;
int keyUpDownChatCounter;
int myLastPreActionBetValue;
int voteOnKickTimeoutSecs;
unsigned playerAboutToBeKickedId;
GameTableStyleReader *myGameTableStyle;
CardDeckStyleReader *myCardDeckStyle;
QString AllInString;
QString RaiseString;
QString BetString;
QString CallString;
QString CheckString;
QString FoldString;
QString PotString;
QString TotalString;
QString BetsString;
QString GameString;
QString HandString;
QString PreflopString;
QString FlopString;
QString TurnString;
QString RiverString;
friend class MyAvatarLabel;
friend class GuiWrapper;
void riverAnimation1();
void riverAnimation1Action();
void riverAnimation2();
void riverAnimation2Action();
void postRiverAnimation1();
void postRiverAnimation1Action();
void postRiverRunAnimation1();
void postRiverRunAnimation2();
void postRiverRunAnimation3();
void postRiverRunAnimation4();
void postRiverRunAnimation5();
void postRiverRunAnimation6();
void showHoleCards(unsigned playerId, bool allIn = false);
void refreshCardsChance(GameState);
void blinkingStartButtonAnimationAction();
void flipHolecardsAllIn();
void triggerVoteOnKick(int id);
void handSwitchRounds();
void startNewHand();
void stopTimer();
void nextRoundCleanGui();
void breakButtonClicked();
void keyPressEvent ( QKeyEvent*);
bool eventFilter(QObject *obj, QEvent *event);
void switchChatWindow();
void switchHelpWindow();
void switchLogWindow();
void switchAwayWindow();
void switchChanceWindow();
void switchFullscreen();
void sendChatMessage();
void checkChatInputLength(QString);
void tabSwitchAction();
void leaveCurrentNetworkGame();
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 changeSpinBoxBetValue(int);
void spinBoxBetValueChanged(int);
void showMaximized ();
void closeGameTable();
void startVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick);
void changeVoteOnKickButtonsState(bool showHide);
void endVoteOnKick();
void voteOnKickYes();
void voteOnKickNo();
void startVoteOnKickTimeout();
void stopVoteOnKickTimeout();
void nextVoteOnKickTimeoutAnimationFrame();
void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick);
void refreshGameTableStyle();
void saveGameTableGeometry();
void restoreGameTableGeometry();
void netClientPlayerLeft(unsigned playerId);
void registeredUserMode();
void guestUserMode();
void showShowMyCardsButton();
void sendShowMyCardsSignal();
void showWarningAutoFoldInRankingGame(unsigned);
void closeMessageBoxes();
private:
boost::shared_ptr<GuiInterface> myServerGuiInterface;
guiLog *myGuiLog;
ChatTools *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;
QTimer *voteOnKickTimeoutTimer;
boost::timers::portable::microsec_timer voteOnKickRealTimer;
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];
MyNameLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS];
MyAvatarLabel *playerAvatarLabelArray[MAX_NUMBER_OF_PLAYERS];
MyTimeoutLabel *timeoutLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *playerStarsArray[6][MAX_NUMBER_OF_PLAYERS];
QGroupBox *groupBoxArray[MAX_NUMBER_OF_PLAYERS];
MyCardsPixmapLabel *boardCardsArray[5];
MyCardsPixmapLabel *holeCardsArray[MAX_NUMBER_OF_PLAYERS][2];
QLabel *playerTipLabelArray[MAX_NUMBER_OF_PLAYERS];
QPixmap flipside;
// Dialogs
startWindowImpl *myStartWindow;
myMessageDialogImpl *myUniversalMessageDialog;
//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;
bool guestMode;
// statistic testing
int statisticArray[15];
QSemaphore guiUpdateSemaphore;
int keyUpDownChatCounter;
int myLastPreActionBetValue;
int voteOnKickTimeoutSecs;
unsigned playerAboutToBeKickedId;
GameTableStyleReader *myGameTableStyle;
CardDeckStyleReader *myCardDeckStyle;
QString AllInString;
QString RaiseString;
QString BetString;
QString CallString;
QString CheckString;
QString FoldString;
QString PotString;
QString TotalString;
QString BetsString;
QString GameString;
QString HandString;
QString PreflopString;
QString FlopString;
QString TurnString;
QString RiverString;
friend class MyAvatarLabel;
friend class GuiWrapper;
};
#endif
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -35,22 +35,22 @@ class GameTableStyleReader;
class guiLog : public QObject
{
Q_OBJECT
Q_OBJECT
public:
guiLog(gameTableImpl*, ConfigFile *c);
guiLog(gameTableImpl*, ConfigFile *c);
~guiLog();
~guiLog();
public slots:
void logPlayerActionMsg(QString playerName, int playerID, int action, int setValue);
void logPlayerActionMsg(QString playerName, int playerID, 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 playerID, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows");
void logFlipHoleCardsMsg(QString playerName, int playerID, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows");
void logPlayerLeftMsg(QString playerName, int wasKicked);
void logNewGameAdminMsg(QString playerName);
void logPlayerWinGame(QString playerName, int gameID);
@@ -66,13 +66,13 @@ public:
void writeLogFileStream(QString string);
signals:
void signalLogPlayerActionMsg(QString playerName, int playerID, int action, int setValue);
void signalLogPlayerActionMsg(QString playerName, int playerID, 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 playerID, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows");
void signalLogFlipHoleCardsMsg(QString playerName, int playerID, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows");
void signalLogPlayerLeftMsg(QString playerName, int wasKicked);
void signalLogNewGameAdminMsg(QString playerName);
void signalLogPlayerWinGame(QString playerName, int gameID);
@@ -87,14 +87,14 @@ private:
ConfigFile *myConfig;
QTextStream stream;
QDir *myLogDir;
QFile *myHtmlLogFile;
sqlite3 *mySqliteLogDb;
QFile *myHtmlLogFile;
sqlite3 *mySqliteLogDb;
QString logFileStreamString;
QString myAppDataPath;
GameTableStyleReader *myStyle;
friend class GuiWrapper;
friend class GuiWrapper;
};
#endif
+18 -19
View File
@@ -1,7 +1,7 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -15,7 +15,7 @@
using namespace std;
MyActionButton::MyActionButton(QGroupBox* parent)
: QPushButton(parent), myStyle(NULL)
: QPushButton(parent), myStyle(NULL)
{
}
@@ -25,23 +25,22 @@ MyActionButton::~MyActionButton()
}
void MyActionButton::paintEvent(QPaintEvent * event) {
void MyActionButton::paintEvent(QPaintEvent * event)
{
QPushButton::paintEvent(event);
QPushButton::paintEvent(event);
QPainter painter(this);
painter.setPen(QColor("#"+myStyle->getFKeyIndicatorColor()));
painter.setOpacity(0.5);
QFont f= painter.font();
f.setPixelSize(9);
painter.setFont(f);
if(objectName()==("pushButton_AllIn")) {
painter.drawText(6,6,15,15,Qt::AlignLeft,fKeyText);
}
else if(objectName()==("pushButton_showMyCards")){
painter.drawText(6,6,15,15,Qt::AlignLeft,QString("F5"));
}
else {
painter.drawText(8,15,15,15,Qt::AlignLeft,fKeyText);
}
QPainter painter(this);
painter.setPen(QColor("#"+myStyle->getFKeyIndicatorColor()));
painter.setOpacity(0.5);
QFont f= painter.font();
f.setPixelSize(9);
painter.setFont(f);
if(objectName()==("pushButton_AllIn")) {
painter.drawText(6,6,15,15,Qt::AlignLeft,fKeyText);
} else if(objectName()==("pushButton_showMyCards")) {
painter.drawText(6,6,15,15,Qt::AlignLeft,QString("F5"));
} else {
painter.drawText(8,15,15,15,Qt::AlignLeft,fKeyText);
}
}
+10 -6
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -20,14 +20,18 @@ class GameTableStyleReader;
class MyActionButton : public QPushButton
{
public:
MyActionButton(QGroupBox*);
MyActionButton(QGroupBox*);
~MyActionButton();
~MyActionButton();
void paintEvent(QPaintEvent * event);
void setFKeyText ( const QString& theValue ){fKeyText = theValue;}
void paintEvent(QPaintEvent * event);
void setFKeyText ( const QString& theValue ) {
fKeyText = theValue;
}
void setMyStyle ( GameTableStyleReader* theValue ) { myStyle = theValue; }
void setMyStyle ( GameTableStyleReader* theValue ) {
myStyle = theValue;
}
private:
+298 -316
View File
@@ -1,7 +1,7 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -22,24 +22,24 @@
using namespace std;
MyAvatarLabel::MyAvatarLabel(QGroupBox* parent)
: QLabel(parent), voteRunning(FALSE), transparent(FALSE)
: QLabel(parent), voteRunning(FALSE), transparent(FALSE)
{
myContextMenu = new QMenu;
action_EditTip = new QAction(QIcon(), tr("Add/Edit/Remove tooltip"), myContextMenu);
myContextMenu->addAction(action_EditTip);
action_VoteForKick = new QAction(QIcon(":/gfx/list_remove_user.png"), tr("Start vote to kick this player"), myContextMenu);
myContextMenu->addAction(action_VoteForKick);
action_IgnorePlayer = new QAction(QIcon(":/gfx/im-ban-user.png"), tr("Ignore Player"), myContextMenu);
myContextMenu->addAction(action_IgnorePlayer);
action_ReportBadAvatar = new QAction(QIcon(":/gfx/emblem-important.png"), tr("Report inappropriate avatar"), myContextMenu);
myContextMenu->addAction(action_ReportBadAvatar);
myContextMenu = new QMenu;
action_EditTip = new QAction(QIcon(), tr("Add/Edit/Remove tooltip"), myContextMenu);
myContextMenu->addAction(action_EditTip);
action_VoteForKick = new QAction(QIcon(":/gfx/list_remove_user.png"), tr("Start vote to kick this player"), myContextMenu);
myContextMenu->addAction(action_VoteForKick);
action_IgnorePlayer = new QAction(QIcon(":/gfx/im-ban-user.png"), tr("Ignore Player"), myContextMenu);
myContextMenu->addAction(action_IgnorePlayer);
action_ReportBadAvatar = new QAction(QIcon(":/gfx/emblem-important.png"), tr("Report inappropriate avatar"), myContextMenu);
myContextMenu->addAction(action_ReportBadAvatar);
connect( action_VoteForKick, SIGNAL ( triggered() ), this, SLOT ( sendTriggerVoteOnKickSignal() ) );
connect( action_IgnorePlayer, SIGNAL ( triggered() ), this, SLOT ( putPlayerOnIgnoreList() ) );
connect( action_ReportBadAvatar, SIGNAL ( triggered() ), this, SLOT ( reportBadAvatar() ) );
connect( action_EditTip, SIGNAL( triggered() ), this, SLOT ( startEditTip() ) );
connect( action_VoteForKick, SIGNAL ( triggered() ), this, SLOT ( sendTriggerVoteOnKickSignal() ) );
connect( action_IgnorePlayer, SIGNAL ( triggered() ), this, SLOT ( putPlayerOnIgnoreList() ) );
connect( action_ReportBadAvatar, SIGNAL ( triggered() ), this, SLOT ( reportBadAvatar() ) );
connect( action_EditTip, SIGNAL( triggered() ), this, SLOT ( startEditTip() ) );
}
@@ -47,395 +47,377 @@ MyAvatarLabel::~MyAvatarLabel()
{
}
void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event )
{
assert(myW->getSession()->getCurrentGame());
if (myW->getSession()->isNetworkClientRunning()) {
assert(myW->getSession()->getCurrentGame());
if (myW->getSession()->isNetworkClientRunning()) {
boost::shared_ptr<PlayerInterface> humanPlayer = myW->getSession()->getCurrentGame()->getSeatsList()->front();
//only active players are allowed to start a vote
if(humanPlayer->getMyActiveStatus()) {
boost::shared_ptr<PlayerInterface> humanPlayer = myW->getSession()->getCurrentGame()->getSeatsList()->front();
//only active players are allowed to start a vote
if(humanPlayer->getMyActiveStatus()) {
boost::shared_ptr<Game> currentGame = myW->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
int activePlayerCounter=0;
PlayerList seatList = currentGame->getSeatsList();
PlayerListConstIterator it_c;
int activePlayerCounter=0;
PlayerList seatList = currentGame->getSeatsList();
for (it_c=seatList->begin(); it_c!=seatList->end(); ++it_c) {
if((*it_c)->getMyActiveStatus()) activePlayerCounter++;
}
GameInfo info(myW->getSession()->getClientGameInfo(myW->getSession()->getClientCurrentGameId()));
if(activePlayerCounter > 2 && !voteRunning && info.data.gameType != GAME_TYPE_RANKING && !myW->getGuestMode()) {
setVoteOnKickContextMenuEnabled(TRUE);
}
else {
setVoteOnKickContextMenuEnabled(FALSE);
}
action_IgnorePlayer->setEnabled(true);
action_EditTip->setEnabled(true);
int j=0;
for (it_c=seatList->begin(); it_c!=seatList->end(); ++it_c) {
if(myId == j) {
if(j == 0)
{
action_EditTip->setDisabled(true);
if((*it_c)->getMyActiveStatus()) activePlayerCounter++;
}
if(myW->myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK)
{
action_EditTip->setDisabled(true);
GameInfo info(myW->getSession()->getClientGameInfo(myW->getSession()->getClientCurrentGameId()));
if(activePlayerCounter > 2 && !voteRunning && info.data.gameType != GAME_TYPE_RANKING && !myW->getGuestMode()) {
setVoteOnKickContextMenuEnabled(TRUE);
} else {
setVoteOnKickContextMenuEnabled(FALSE);
}
if(myW->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest) {
action_IgnorePlayer->setDisabled(true);
action_EditTip->setDisabled(true);
}
if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET && !((*it_c)->getMyAvatar().empty()) ) {
action_ReportBadAvatar->setVisible(TRUE);
}
else {
action_ReportBadAvatar->setVisible(FALSE);
}
}
j++;
}
int i=0;
action_IgnorePlayer->setEnabled(true);
action_EditTip->setEnabled(true);
int j=0;
for (it_c=seatList->begin(); it_c!=seatList->end(); ++it_c) {
//also inactive player which stays on table can be voted to kick
if(myContextMenuEnabled && myId != 0 && myId == i && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER && ( (*it_c)->getMyActiveStatus() || (*it_c)->getMyStayOnTableStatus() ) )
showContextMenu(event->globalPos());
if(myId == j) {
if(j == 0) {
action_EditTip->setDisabled(true);
}
if(myW->myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) {
action_EditTip->setDisabled(true);
}
i++;
}
}
}
if(myW->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest) {
action_IgnorePlayer->setDisabled(true);
action_EditTip->setDisabled(true);
}
if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET && !((*it_c)->getMyAvatar().empty()) ) {
action_ReportBadAvatar->setVisible(TRUE);
} else {
action_ReportBadAvatar->setVisible(FALSE);
}
}
j++;
}
int i=0;
for (it_c=seatList->begin(); it_c!=seatList->end(); ++it_c) {
//also inactive player which stays on table can be voted to kick
if(myContextMenuEnabled && myId != 0 && myId == i && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER && ( (*it_c)->getMyActiveStatus() || (*it_c)->getMyStayOnTableStatus() ) )
showContextMenu(event->globalPos());
i++;
}
}
}
}
void MyAvatarLabel::showContextMenu(const QPoint &pos) {
void MyAvatarLabel::showContextMenu(const QPoint &pos)
{
myContextMenu->popup(pos);
myContextMenu->popup(pos);
}
void MyAvatarLabel::setPlayerRating(QString playerInfo)
{
int found=0;
QStringList playerInfoList=playerInfo.split("\"", QString::KeepEmptyParts, Qt::CaseSensitive), tipInfo;
boost::shared_ptr<Game> currentGame = myW->myStartWindow->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
PlayerList seatsList = currentGame->getSeatsList();
std::list<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string> result;
std::string separator="(!#$%)";
std::list<std::string>::iterator iterator;
for(iterator = tipsList.begin(); iterator != tipsList.end(); ++iterator) {
tipInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive);
if(tipInfo.at(0)==playerInfoList.at(0))
{
result.push_back(tipInfo.at(0).toUtf8().constData()+separator+tipInfo.at(1).toUtf8().constData()+separator+playerInfoList.at(1).toUtf8().constData()+separator);
found=1;
}
else
{
result.push_back(tipInfo.at(0).toUtf8().constData()+separator+tipInfo.at(1).toUtf8().constData()+separator+tipInfo.at(2).toUtf8().constData()+separator);
}
}
if(found==0)
{
result.push_back(playerInfoList.at(0).toUtf8().constData()+separator+separator+playerInfoList.at(1).toUtf8().constData()+separator);
}
myW->getMyConfig()->writeConfigStringList("PlayerTooltips", result);
myW->getMyConfig()->writeBuffer();
refreshStars();
int found=0;
QStringList playerInfoList=playerInfo.split("\"", QString::KeepEmptyParts, Qt::CaseSensitive), tipInfo;
boost::shared_ptr<Game> currentGame = myW->myStartWindow->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
PlayerList seatsList = currentGame->getSeatsList();
std::list<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string> result;
std::string separator="(!#$%)";
std::list<std::string>::iterator iterator;
for(iterator = tipsList.begin(); iterator != tipsList.end(); ++iterator) {
tipInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive);
if(tipInfo.at(0)==playerInfoList.at(0)) {
result.push_back(tipInfo.at(0).toUtf8().constData()+separator+tipInfo.at(1).toUtf8().constData()+separator+playerInfoList.at(1).toUtf8().constData()+separator);
found=1;
} else {
result.push_back(tipInfo.at(0).toUtf8().constData()+separator+tipInfo.at(1).toUtf8().constData()+separator+tipInfo.at(2).toUtf8().constData()+separator);
}
}
if(found==0) {
result.push_back(playerInfoList.at(0).toUtf8().constData()+separator+separator+playerInfoList.at(1).toUtf8().constData()+separator);
}
myW->getMyConfig()->writeConfigStringList("PlayerTooltips", result);
myW->getMyConfig()->writeBuffer();
refreshStars();
}
void MyAvatarLabel::startChangePlayerTip(QString playerName)
{
if(myW->tabWidget_Left->widget(2) == myW->tab_Kick)
{
myW->tabWidget_Left->insertTab(3, myW->tab_editTip, playerName);
myW->tabWidget_Left->setCurrentIndex(3);
}
else
{
myW->tabWidget_Left->insertTab(2, myW->tab_editTip, playerName);
myW->tabWidget_Left->setCurrentIndex(2);
}
myW->textEdit_tipInput->setPlainText(getPlayerTip(playerName));
}
void MyAvatarLabel::startChangePlayerTip(QString playerName)
{
if(myW->tabWidget_Left->widget(2) == myW->tab_Kick) {
myW->tabWidget_Left->insertTab(3, myW->tab_editTip, playerName);
myW->tabWidget_Left->setCurrentIndex(3);
} else {
myW->tabWidget_Left->insertTab(2, myW->tab_editTip, playerName);
myW->tabWidget_Left->setCurrentIndex(2);
}
myW->textEdit_tipInput->setPlainText(getPlayerTip(playerName));
}
void MyAvatarLabel::refreshStars()
{
boost::shared_ptr<Game> curGame = myW->myStartWindow->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
int seatPlace;
PlayerList seatsList = curGame->getSeatsList();
for (seatPlace=0,it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c, seatPlace++) {
for(int i=1;i<=5;i++)myW->playerStarsArray[i][seatPlace]->setText("");
if(myW->myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET && !myW->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER)
if((*it_c)->getMyStayOnTableStatus() == TRUE && (*it_c)->getMyName()!="" && seatPlace!=0) {
int playerStars=getPlayerRating(QString::fromUtf8((*it_c)->getMyName().c_str()));
for(int i=1;i<=5;i++)
{
myW->playerStarsArray[i][seatPlace]->setText("<a style='color: yellow;' href='"+QString::fromUtf8((*it_c)->getMyName().c_str())+"\""+QString::number(i)+"'>&#9734;</a>");
}
for(int i=1;i<=playerStars;i++)
{
myW->playerStarsArray[i][seatPlace]->setText("<a style='color: #"+myW->getMyGameTableStyle()->getRatingStarsColor()+";' href='"+QString::fromUtf8((*it_c)->getMyName().c_str())+"\""+QString::number(i)+"'>&#9733;</a>");
}
boost::shared_ptr<Game> curGame = myW->myStartWindow->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
int seatPlace;
PlayerList seatsList = curGame->getSeatsList();
for (seatPlace=0,it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c, seatPlace++) {
for(int i=1; i<=5; i++)myW->playerStarsArray[i][seatPlace]->setText("");
if(myW->myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET && !myW->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER)
if((*it_c)->getMyStayOnTableStatus() == TRUE && (*it_c)->getMyName()!="" && seatPlace!=0) {
int playerStars=getPlayerRating(QString::fromUtf8((*it_c)->getMyName().c_str()));
for(int i=1; i<=5; i++) {
myW->playerStarsArray[i][seatPlace]->setText("<a style='color: yellow;' href='"+QString::fromUtf8((*it_c)->getMyName().c_str())+"\""+QString::number(i)+"'>&#9734;</a>");
}
for(int i=1; i<=playerStars; i++) {
myW->playerStarsArray[i][seatPlace]->setText("<a style='color: #"+myW->getMyGameTableStyle()->getRatingStarsColor()+";' href='"+QString::fromUtf8((*it_c)->getMyName().c_str())+"\""+QString::number(i)+"'>&#9733;</a>");
}
}
}
}
}
void MyAvatarLabel::refreshTooltips() {
void MyAvatarLabel::refreshTooltips()
{
boost::shared_ptr<Game> currentGame = myW->myStartWindow->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
PlayerListConstIterator it_c;
int seatPlace;
PlayerList seatsList = currentGame->getSeatsList();
for (seatPlace=0,it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c, seatPlace++) {
if((*it_c)->getMyStayOnTableStatus() == TRUE || (*it_c)->getMyActiveStatus()) {
bool computerPlayer = false;
if((*it_c)->getMyType() == PLAYER_TYPE_COMPUTER) { computerPlayer = true; }
if(!computerPlayer && getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str()))!="")
{
myW->playerTipLabelArray[(*it_c)->getMyID()]->setText(QString("<a style='text-decoration: none; color: #"+myW->getMyGameTableStyle()->getPlayerInfoHintTextColor()+"; font-size: 14px; font-weight: bold; font-family:serif;' href=\'")+QString::fromUtf8((*it_c)->getMyName().c_str())+"\'>i</a>");
myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip( getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str())) );
myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip( getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str())) );
}
else
{
myW->playerTipLabelArray[(*it_c)->getMyID()]->setText("");
myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip("");
myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip("");
}
}
else
{
myW->playerTipLabelArray[(*it_c)->getMyID()]->setText("");
myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip("");
myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip("");
PlayerList seatsList = currentGame->getSeatsList();
for (seatPlace=0,it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c, seatPlace++) {
if((*it_c)->getMyStayOnTableStatus() == TRUE || (*it_c)->getMyActiveStatus()) {
bool computerPlayer = false;
if((*it_c)->getMyType() == PLAYER_TYPE_COMPUTER) {
computerPlayer = true;
}
if(!computerPlayer && getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str()))!="") {
myW->playerTipLabelArray[(*it_c)->getMyID()]->setText(QString("<a style='text-decoration: none; color: #"+myW->getMyGameTableStyle()->getPlayerInfoHintTextColor()+"; font-size: 14px; font-weight: bold; font-family:serif;' href=\'")+QString::fromUtf8((*it_c)->getMyName().c_str())+"\'>i</a>");
myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip( getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str())) );
myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip( getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str())) );
} else {
myW->playerTipLabelArray[(*it_c)->getMyID()]->setText("");
myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip("");
myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip("");
}
} else {
myW->playerTipLabelArray[(*it_c)->getMyID()]->setText("");
myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip("");
myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip("");
}
}
}
refreshStars();
}
refreshStars();
}
int MyAvatarLabel::getPlayerRating(QString playerName)
{
std::list<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string>::iterator iterator;
QStringList playerInfo;
QString result="0";
for(iterator = tipsList.begin(); iterator != tipsList.end(); ++iterator) {
playerInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive);
if(playerInfo.at(0)==playerName)
{
result=playerInfo.at(2);
break;
std::list<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string>::iterator iterator;
QStringList playerInfo;
QString result="0";
for(iterator = tipsList.begin(); iterator != tipsList.end(); ++iterator) {
playerInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive);
if(playerInfo.at(0)==playerName) {
result=playerInfo.at(2);
break;
}
}
return result.toInt();
}
return result.toInt();
}
QString MyAvatarLabel::getPlayerTip(QString playerName)
{
std::list<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string>::iterator iterator;
QStringList playerInfo;
for(iterator = tipsList.begin(); iterator != tipsList.end(); ++iterator) {
playerInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive);
if(playerInfo.at(0)==playerName)return playerInfo.at(1);
}
return QString("");
std::list<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string>::iterator iterator;
QStringList playerInfo;
for(iterator = tipsList.begin(); iterator != tipsList.end(); ++iterator) {
playerInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive);
if(playerInfo.at(0)==playerName)return playerInfo.at(1);
}
return QString("");
}
void MyAvatarLabel::setPlayerTip()
{
int found=0;
std::string rating="1", separator="(!#$%)";
std::string tip = std::string((const char*)myW->textEdit_tipInput->toPlainText().toUtf8());
std::string playerName;
if(myW->tabWidget_Left->widget(2) == myW->tab_editTip)playerName = myW->tabWidget_Left->tabText(2).toUtf8().constData();
if(myW->tabWidget_Left->widget(3) == myW->tab_editTip)playerName = myW->tabWidget_Left->tabText(3).toUtf8().constData();
QStringList playerInfo;
std::list<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string> result;
std::list<std::string>::iterator iterator;
for(iterator = tipsList.begin(); iterator != tipsList.end(); ++iterator) {
playerInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive);
if(QString::fromUtf8(playerName.c_str())==playerInfo.at(0))
{
result.push_back(playerName+separator+QString::fromUtf8(tip.c_str()).toUtf8().constData()+separator+playerInfo.at(2).toStdString()+separator);
found=1;
}
else
{
result.push_back(playerInfo.at(0).toUtf8().constData()+separator+playerInfo.at(1).toUtf8().constData()+separator+playerInfo.at(2).toStdString()+separator);
}
}
if(found==0)
{
result.push_back(playerName.c_str()+separator+QString::fromUtf8(tip.c_str()).toUtf8().constData()+separator+QString("0").toStdString()+separator);
}
myW->getMyConfig()->writeConfigStringList("PlayerTooltips", result);
myW->getMyConfig()->writeBuffer();
int found=0;
std::string rating="1", separator="(!#$%)";
std::string tip = std::string((const char*)myW->textEdit_tipInput->toPlainText().toUtf8());
std::string playerName;
if(myW->tabWidget_Left->widget(2) == myW->tab_editTip)playerName = myW->tabWidget_Left->tabText(2).toUtf8().constData();
if(myW->tabWidget_Left->widget(3) == myW->tab_editTip)playerName = myW->tabWidget_Left->tabText(3).toUtf8().constData();
QStringList playerInfo;
std::list<std::string> tipsList = myW->getMyConfig()->readConfigStringList("PlayerTooltips");
std::list<std::string> result;
std::list<std::string>::iterator iterator;
for(iterator = tipsList.begin(); iterator != tipsList.end(); ++iterator) {
playerInfo=QString::fromUtf8(iterator->c_str()).split("(!#$%)", QString::KeepEmptyParts, Qt::CaseSensitive);
if(QString::fromUtf8(playerName.c_str())==playerInfo.at(0)) {
result.push_back(playerName+separator+QString::fromUtf8(tip.c_str()).toUtf8().constData()+separator+playerInfo.at(2).toStdString()+separator);
found=1;
} else {
result.push_back(playerInfo.at(0).toUtf8().constData()+separator+playerInfo.at(1).toUtf8().constData()+separator+playerInfo.at(2).toStdString()+separator);
}
}
if(found==0) {
result.push_back(playerName.c_str()+separator+QString::fromUtf8(tip.c_str()).toUtf8().constData()+separator+QString("0").toStdString()+separator);
}
myW->getMyConfig()->writeConfigStringList("PlayerTooltips", result);
myW->getMyConfig()->writeBuffer();
if(myW->tabWidget_Left->widget(3) == myW->tab_editTip)
{
myW->tabWidget_Left->removeTab(3);
}
else if(myW->tabWidget_Left->widget(2) == myW->tab_editTip)
{
myW->tabWidget_Left->removeTab(2);
}
refreshTooltips();
if(myW->tabWidget_Left->widget(3) == myW->tab_editTip) {
myW->tabWidget_Left->removeTab(3);
} else if(myW->tabWidget_Left->widget(2) == myW->tab_editTip) {
myW->tabWidget_Left->removeTab(2);
}
refreshTooltips();
}
void MyAvatarLabel::sendTriggerVoteOnKickSignal()
{
myW->triggerVoteOnKick(myId);
myW->triggerVoteOnKick(myId);
}
void MyAvatarLabel::setEnabledContextMenu(bool b)
{
myContextMenuEnabled = b;
myContextMenuEnabled = b;
}
void MyAvatarLabel::setVoteOnKickContextMenuEnabled(bool b)
{
action_VoteForKick->setEnabled(b);
action_VoteForKick->setEnabled(b);
}
void MyAvatarLabel::setPixmap ( const QPixmap &pix, const bool trans) {
void MyAvatarLabel::setPixmap ( const QPixmap &pix, const bool trans)
{
myPixmap = pix.scaled(50,50, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
transparent = trans;
update();
myPixmap = pix.scaled(50,50, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
transparent = trans;
update();
}
void MyAvatarLabel::setPixmapAndCountry ( const QPixmap &pix,QString countryString, int seatPlace, const bool trans) {
QPixmap resultAvatar(pix.scaled(50,50, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
QPainter painter(&resultAvatar);
int showCountryFlags = myW->getMyConfig()->readConfigInt("ShowCountryFlagInAvatar");
if(showCountryFlags && !countryString.isEmpty())
{
if(seatPlace<=2||seatPlace>=8)
{
painter.drawPixmap(resultAvatar.width()-(QPixmap(countryString)).width(),resultAvatar.height()-(QPixmap(countryString)).height(),QPixmap(countryString));
}
else
{
painter.drawPixmap(resultAvatar.width()-(QPixmap(countryString)).width(),0,QPixmap(countryString));
void MyAvatarLabel::setPixmapAndCountry ( const QPixmap &pix,QString countryString, int seatPlace, const bool trans)
{
QPixmap resultAvatar(pix.scaled(50,50, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
QPainter painter(&resultAvatar);
int showCountryFlags = myW->getMyConfig()->readConfigInt("ShowCountryFlagInAvatar");
if(showCountryFlags && !countryString.isEmpty()) {
if(seatPlace<=2||seatPlace>=8) {
painter.drawPixmap(resultAvatar.width()-(QPixmap(countryString)).width(),resultAvatar.height()-(QPixmap(countryString)).height(),QPixmap(countryString));
} else {
painter.drawPixmap(resultAvatar.width()-(QPixmap(countryString)).width(),0,QPixmap(countryString));
}
}
}
painter.end();
myPixmap = resultAvatar;
transparent = trans;
update();
painter.end();
myPixmap = resultAvatar;
transparent = trans;
update();
}
void MyAvatarLabel::paintEvent(QPaintEvent*) {
void MyAvatarLabel::paintEvent(QPaintEvent*)
{
QPainter painter(this);
if(transparent)
painter.setOpacity(0.4);
else
painter.setOpacity(1.0);
QPainter painter(this);
if(transparent)
painter.setOpacity(0.4);
else
painter.setOpacity(1.0);
painter.drawPixmap(0,0,myPixmap);
painter.drawPixmap(0,0,myPixmap);
}
bool MyAvatarLabel::playerIsOnIgnoreList(QString playerName) {
bool MyAvatarLabel::playerIsOnIgnoreList(QString playerName)
{
list<std::string> playerIgnoreList = myW->getMyConfig()->readConfigStringList("PlayerIgnoreList");
list<std::string>::iterator it1;
list<std::string> playerIgnoreList = myW->getMyConfig()->readConfigStringList("PlayerIgnoreList");
list<std::string>::iterator it1;
for(it1= playerIgnoreList.begin(); it1 != playerIgnoreList.end(); ++it1) {
if(playerName == QString::fromUtf8(it1->c_str())) {
return true;
}
}
return false;
if(playerName == QString::fromUtf8(it1->c_str())) {
return true;
}
}
return false;
}
void MyAvatarLabel::putPlayerOnIgnoreList() {
void MyAvatarLabel::putPlayerOnIgnoreList()
{
QStringList list;
PlayerListConstIterator it_c;
PlayerList seatList = myW->getSession()->getCurrentGame()->getSeatsList();
QStringList list;
PlayerListConstIterator it_c;
PlayerList seatList = myW->getSession()->getCurrentGame()->getSeatsList();
for (it_c=seatList->begin(); it_c!=seatList->end(); ++it_c) {
list << QString::fromUtf8((*it_c)->getMyName().c_str());
}
list << QString::fromUtf8((*it_c)->getMyName().c_str());
}
if(!playerIsOnIgnoreList(list.at(myId))) {
if(!playerIsOnIgnoreList(list.at(myId))) {
myMessageDialogImpl dialog(myW->getMyConfig(), this);
if(dialog.exec(4, tr("You will no longer receive chat messages or game invitations from this user.<br>Do you really want to put player <b>%1</b> on ignore list?").arg(list.at(myId)), tr("PokerTH - Question"), QPixmap(":/gfx/im-ban-user_64.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, false ) == QDialog::Accepted) {
myMessageDialogImpl dialog(myW->getMyConfig(), this);
if(dialog.exec(4, tr("You will no longer receive chat messages or game invitations from this user.<br>Do you really want to put player <b>%1</b> on ignore list?").arg(list.at(myId)), tr("PokerTH - Question"), QPixmap(":/gfx/im-ban-user_64.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, false ) == QDialog::Accepted) {
std::list<std::string> playerIgnoreList = myW->getMyConfig()->readConfigStringList("PlayerIgnoreList");
playerIgnoreList.push_back(list.at(myId).toUtf8().constData());
myW->getMyConfig()->writeConfigStringList("PlayerIgnoreList", playerIgnoreList);
myW->getMyConfig()->writeBuffer();
std::list<std::string> playerIgnoreList = myW->getMyConfig()->readConfigStringList("PlayerIgnoreList");
playerIgnoreList.push_back(list.at(myId).toUtf8().constData());
myW->getMyConfig()->writeConfigStringList("PlayerIgnoreList", playerIgnoreList);
myW->getMyConfig()->writeBuffer();
myW->getMyChat()->refreshIgnoreList();
}
}
}
void MyAvatarLabel::reportBadAvatar() {
boost::shared_ptr<Game> currentGame = myW->getSession()->getCurrentGame();
int j=0;
PlayerListConstIterator it_c;
PlayerList seatList = currentGame->getSeatsList();
for (it_c=seatList->begin(); it_c!=seatList->end(); ++it_c) {
if(myId == j) {
QString avatar = QString::fromUtf8((*it_c)->getMyAvatar().c_str());
if(!avatar.isEmpty()) {
QString nick = QString::fromUtf8((*it_c)->getMyName().c_str());
int ret = QMessageBox::question(this, tr("PokerTH - Question"),
tr("Are you sure you want to report the avatar of \"%1\" as inappropriate?").arg(nick), QMessageBox::Yes | QMessageBox::No);
if(ret == QMessageBox::Yes) {
QFileInfo fi(avatar);
myW->getSession()->reportBadAvatar((*it_c)->getMyUniqueID(), fi.baseName().toStdString());
}
}
break;
}
j++;
}
}
void MyAvatarLabel::startEditTip() {
boost::shared_ptr<Game> currentGame = myW->getSession()->getCurrentGame();
int j=0;
PlayerListConstIterator it_c;
PlayerList seatList = currentGame->getSeatsList();
for (it_c=seatList->begin(); it_c!=seatList->end(); ++it_c) {
if(myId == j) {
QString nick = QString::fromUtf8((*it_c)->getMyName().c_str());
startChangePlayerTip(nick);
break;
myW->getMyChat()->refreshIgnoreList();
}
j++;
}
}
void MyAvatarLabel::reportBadAvatar()
{
boost::shared_ptr<Game> currentGame = myW->getSession()->getCurrentGame();
int j=0;
PlayerListConstIterator it_c;
PlayerList seatList = currentGame->getSeatsList();
for (it_c=seatList->begin(); it_c!=seatList->end(); ++it_c) {
if(myId == j) {
QString avatar = QString::fromUtf8((*it_c)->getMyAvatar().c_str());
if(!avatar.isEmpty()) {
QString nick = QString::fromUtf8((*it_c)->getMyName().c_str());
int ret = QMessageBox::question(this, tr("PokerTH - Question"),
tr("Are you sure you want to report the avatar of \"%1\" as inappropriate?").arg(nick), QMessageBox::Yes | QMessageBox::No);
if(ret == QMessageBox::Yes) {
QFileInfo fi(avatar);
myW->getSession()->reportBadAvatar((*it_c)->getMyUniqueID(), fi.baseName().toStdString());
}
}
break;
}
j++;
}
}
void MyAvatarLabel::startEditTip()
{
boost::shared_ptr<Game> currentGame = myW->getSession()->getCurrentGame();
int j=0;
PlayerListConstIterator it_c;
PlayerList seatList = currentGame->getSeatsList();
for (it_c=seatList->begin(); it_c!=seatList->end(); ++it_c) {
if(myId == j) {
QString nick = QString::fromUtf8((*it_c)->getMyName().c_str());
startChangePlayerTip(nick);
break;
}
j++;
}
}
+30 -22
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -22,53 +22,61 @@ class startWindowImpl;
class MyAvatarLabel : public QLabel
{
Q_OBJECT
Q_OBJECT
public:
MyAvatarLabel(QGroupBox*);
~MyAvatarLabel();
MyAvatarLabel(QGroupBox*);
~MyAvatarLabel();
void setMyW(gameTableImpl* theValue) { myW = theValue; }
void setMyId ( int theValue ) { myId = theValue; }
void setMyW(gameTableImpl* theValue) {
myW = theValue;
}
void setMyId ( int theValue ) {
myId = theValue;
}
void contextMenuEvent ( QContextMenuEvent * event );
QString getPlayerTip(QString);
int getPlayerRating(QString);
public slots:
void showContextMenu(const QPoint &pos);
void sendTriggerVoteOnKickSignal();
void sendTriggerVoteOnKickSignal();
void setEnabledContextMenu(bool);
void setVoteOnKickContextMenuEnabled(bool);
void setVoteRunning ( bool theValue ) { voteRunning = theValue; }
void setPixmap ( const QPixmap &, const bool = FALSE);
void setVoteRunning ( bool theValue ) {
voteRunning = theValue;
}
void setPixmap ( const QPixmap &, const bool = FALSE);
void setPixmapAndCountry ( const QPixmap &, QString country, int seatPlace, const bool = FALSE);
void setPixmapPath ( const QString theValue) { myPath = theValue; }
void paintEvent(QPaintEvent*);
void putPlayerOnIgnoreList();
bool playerIsOnIgnoreList(QString playerName);
void reportBadAvatar();
void setPixmapPath ( const QString theValue) {
myPath = theValue;
}
void paintEvent(QPaintEvent*);
void putPlayerOnIgnoreList();
bool playerIsOnIgnoreList(QString playerName);
void reportBadAvatar();
void startEditTip();
void startChangePlayerTip(QString playerName);
void setPlayerTip();
void setPlayerRating(QString);
void refreshTooltips();
void refreshStars();
private:
private:
gameTableImpl *myW;
QMenu *myContextMenu;
QAction *action_VoteForKick;
QAction *action_IgnorePlayer;
QAction *action_ReportBadAvatar;
QAction *action_IgnorePlayer;
QAction *action_ReportBadAvatar;
QAction *action_EditTip;
QPixmap myPixmap;
QString myPath;
QPixmap myPixmap;
QString myPath;
int myId;
bool myContextMenuEnabled;
bool myContextMenuEnabled;
bool voteRunning;
bool transparent;
bool transparent;
};
#endif
+95 -74
View File
@@ -1,7 +1,7 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -14,7 +14,7 @@
// using namespace std;
MyCardsPixmapLabel::MyCardsPixmapLabel(QGroupBox* parent)
: QLabel(parent), myW(NULL)
: QLabel(parent), myW(NULL)
{
this->setMouseTracking(TRUE);
@@ -23,13 +23,13 @@ MyCardsPixmapLabel::MyCardsPixmapLabel(QGroupBox* parent)
flipCardsAction1 = FALSE;
flipCardsAction2 = FALSE;
mousePress = FALSE;
mousePress = FALSE;
fastFlipCardsFront = FALSE;
// rotationIntervall = 0.03;
isFlipside = FALSE;
fadeOutTimer = new QTimer;
connect(fadeOutTimer, SIGNAL(timeout()), this, SLOT(nextFadeOutFrame()));
flipCardsTimer = new QTimer;
@@ -43,52 +43,61 @@ MyCardsPixmapLabel::~MyCardsPixmapLabel()
{
}
void MyCardsPixmapLabel::startFadeOut(int speed) {
void MyCardsPixmapLabel::startFadeOut(int speed)
{
frameOpacity = 1.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 <= 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 = 1.0;
fadeOutTimer->start(40);
}
}
}
void MyCardsPixmapLabel::stopFadeOut() {
void MyCardsPixmapLabel::stopFadeOut()
{
fadeOutTimer->stop();
fadeOutAction = FALSE;
frameOpacity = 1.0;
update();
fadeOutTimer->stop();
fadeOutAction = FALSE;
frameOpacity = 1.0;
update();
}
void MyCardsPixmapLabel::nextFadeOutFrame() {
void MyCardsPixmapLabel::nextFadeOutFrame()
{
if (frameOpacity > 0.25) {
frameOpacity -= opacityRaiseInterval;
update();
}
else {
fadeOutTimer->stop();
update();
} else {
fadeOutTimer->stop();
// fadeOutAction = FALSE;
}
}
void MyCardsPixmapLabel::startFlipCards(int speed, const QPixmap &frontPix, const QPixmap &flipsidePix) {
stopFadeOut();
void MyCardsPixmapLabel::startFlipCards(int speed, const QPixmap &frontPix, const QPixmap &flipsidePix)
{
stopFadeOut();
stopFlipCards = FALSE;
isFlipside = FALSE;
isFlipside = FALSE;
QLabel::setPixmap(frontPix);
@@ -98,21 +107,30 @@ void MyCardsPixmapLabel::startFlipCards(int speed, const QPixmap &frontPix, cons
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 <= 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() {
void MyCardsPixmapLabel::stopFlipCardsAnimation()
{
flipCardsTimer->stop();
flipCardsAction1 = FALSE;
flipCardsAction2 = FALSE;
@@ -120,46 +138,47 @@ void MyCardsPixmapLabel::stopFlipCardsAnimation() {
update();
}
void MyCardsPixmapLabel::nextFlipCardsFrame() {
void MyCardsPixmapLabel::nextFlipCardsFrame()
{
if (frameFlipCardsAction1Size > 0.1 ) {
//erst flipside verkleinern
frameFlipCardsAction1Size -= flipCardsScaleIntervall;
update();
}
else {
if(flipCardsAction1) {
update();
} else {
if(flipCardsAction1) {
flipCardsAction1 = FALSE;
flipCardsAction2 = TRUE;
}
else {
} else {
//dann front vergrößern
if (frameFlipCardsAction2Size < 0.9 ) {
frameFlipCardsAction2Size += flipCardsScaleIntervall;
update();
}
else {
} else {
flipCardsAction2 = FALSE;
flipCardsTimer->stop();
flipCardsTimer->stop();
}
}
}
}
void MyCardsPixmapLabel::setPixmap(const QPixmap &pic, const bool flipsideIs) {
void MyCardsPixmapLabel::setPixmap(const QPixmap &pic, const bool flipsideIs)
{
QLabel::setPixmap(pic);
isFlipside = flipsideIs;
}
void MyCardsPixmapLabel::setHiddenFrontPixmap ( const QPixmap &pic ) {
void MyCardsPixmapLabel::setHiddenFrontPixmap ( const QPixmap &pic )
{
myHiddenFront = pic.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);;
}
void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) {
void MyCardsPixmapLabel::paintEvent(QPaintEvent * event)
{
if (!(flipCardsAction1 || flipCardsAction2 || fadeOutAction)) {
QLabel::paintEvent(event);
@@ -168,10 +187,10 @@ void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) {
if (fadeOutAction && !fastFlipCardsFront) {
QPainter painter(this);
painter.setOpacity(frameOpacity);
if(isFlipside)
painter.drawPixmap(0,0, flipside);
else
painter.drawPixmap(0,0, front);
if(isFlipside)
painter.drawPixmap(0,0, flipside);
else
painter.drawPixmap(0,0, front);
}
if (flipCardsAction1) {
@@ -182,7 +201,7 @@ void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) {
painter2.translate(-center);
painter2.drawPixmap(0,0, flipside);
}
if (flipCardsAction2) {
QPainter painter3(this);
QPointF center(front.width()/2.0, front.height()/2.0);
@@ -192,46 +211,48 @@ void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) {
painter3.drawPixmap(0,0, front);
}
if (fastFlipCardsFront && !flipCardsAction1 && !flipCardsAction2) {
if (fastFlipCardsFront && !flipCardsAction1 && !flipCardsAction2) {
if(objectName().contains("pixmapLabel_card0")) {
QPainter painter4(this);
if(fadeOutAction) {
painter4.setOpacity(0.25);
}
painter4.drawPixmap(0,0, myHiddenFront);
painter4.drawPixmap(0,0, myHiddenFront);
}
}
}
void MyCardsPixmapLabel::fastFlipCards(bool front){
void MyCardsPixmapLabel::fastFlipCards(bool front)
{
if (front) {
fastFlipCardsFront = TRUE;
fastFlipCardsFront = TRUE;
update();
}
else {
fastFlipCardsFront = FALSE;
} else {
fastFlipCardsFront = FALSE;
update();
}
}
void MyCardsPixmapLabel::mousePressEvent(QMouseEvent * event) {
void MyCardsPixmapLabel::mousePressEvent(QMouseEvent * event)
{
if (!mousePress && objectName().contains("pixmapLabel_card0")) {
mousePress = TRUE;
myW->mouseOverFlipCards(TRUE);
mousePress = TRUE;
myW->mouseOverFlipCards(TRUE);
}
QLabel::mousePressEvent(event);
QLabel::mousePressEvent(event);
}
void MyCardsPixmapLabel::mouseReleaseEvent(QMouseEvent * event) {
void MyCardsPixmapLabel::mouseReleaseEvent(QMouseEvent * event)
{
if (mousePress && objectName().contains("pixmapLabel_card0")) {
mousePress = FALSE;
mousePress = FALSE;
myW->mouseOverFlipCards(FALSE);
}
}
QLabel::mouseReleaseEvent(event);
QLabel::mouseReleaseEvent(event);
}
+41 -27
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -21,26 +21,38 @@ class gameTableImpl;
class MyCardsPixmapLabel : public QLabel
{
Q_OBJECT
Q_OBJECT
public:
MyCardsPixmapLabel(QGroupBox*);
MyCardsPixmapLabel(QGroupBox*);
~MyCardsPixmapLabel();
~MyCardsPixmapLabel();
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
void setMyW ( gameTableImpl* 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 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 stopFadeOut();
void stopFadeOut();
void startFlipCards(int, const QPixmap & , const QPixmap &);
void stopFlipCardsAnimation();
void setFlipsidePix(QPixmap p) { flipside = p; }
void setFlipsidePix(QPixmap p) {
flipside = p;
}
void paintEvent(QPaintEvent * event);
@@ -49,26 +61,28 @@ signals:
public slots:
void setPixmap ( const QPixmap &, const bool );
void setHiddenFrontPixmap ( const QPixmap &);
void nextFadeOutFrame();
void nextFlipCardsFrame();
void fastFlipCards(bool front);
// void mouseMoveEvent ( QMouseEvent *);
// void mouseMoveEvent ( QMouseEvent *);
void mousePressEvent ( QMouseEvent *);
void mouseReleaseEvent ( QMouseEvent *);
void setFront ( const QPixmap& theValue ) { front = theValue; }
void setFront ( const QPixmap& theValue ) {
front = theValue;
}
private:
gameTableImpl* myW;
private:
gameTableImpl* myW;
qreal frameOpacity;
qreal opacityRaiseInterval;
@@ -78,22 +92,22 @@ private:
qreal frameFlipCardsAction2Size;
QTimer *fadeOutTimer;
QTimer *flipCardsTimer;
QTimer *flipCardsTimer;
bool isFlipside;
bool fadeOutAction;
bool flipCardsAction1;
bool flipCardsAction2;
bool stopFlipCards;
bool mousePress;
bool fastFlipCardsFront;
bool mousePress;
bool fastFlipCardsFront;
QPixmap front;
QPixmap flipside;
QPixmap myHiddenFront;
friend class gameTableImpl;
friend class gameTableImpl;
};
#endif
+82 -51
View File
@@ -1,7 +1,7 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -16,29 +16,29 @@
using namespace std;
MyChanceLabel::MyChanceLabel(QWidget* parent)
: QLabel(parent), myW(0), myStyle(0)
: QLabel(parent), myW(0), myStyle(0)
{
RFChance[0] = 0;
SFChance[0] = 0;
FOAKChance[0] = 0;
FHChance[0] = 0;
FLChance[0] = 0;
STRChance[0] = 0;
TOAKChance[0] = 0;
TPChance[0] = 0;
OPChance[0] = 0;
HCChance[0] = 0;
RFChance[0] = 0;
SFChance[0] = 0;
FOAKChance[0] = 0;
FHChance[0] = 0;
FLChance[0] = 0;
STRChance[0] = 0;
TOAKChance[0] = 0;
TPChance[0] = 0;
OPChance[0] = 0;
HCChance[0] = 0;
RFChance[1] = 0;
SFChance[1] = 0;
FOAKChance[1] = 0;
FHChance[1] = 0;
FLChance[1] = 0;
STRChance[1] = 0;
TOAKChance[1] = 0;
TPChance[1] = 0;
OPChance[1] = 0;
HCChance[1] = 0;
RFChance[1] = 0;
SFChance[1] = 0;
FOAKChance[1] = 0;
FHChance[1] = 0;
FLChance[1] = 0;
STRChance[1] = 0;
TOAKChance[1] = 0;
TPChance[1] = 0;
OPChance[1] = 0;
HCChance[1] = 0;
}
MyChanceLabel::~MyChanceLabel()
@@ -72,19 +72,20 @@ void MyChanceLabel::refreshChance(vector< vector<int> > chance)
update();
}
void MyChanceLabel::paintEvent(QPaintEvent * /*event*/) {
void MyChanceLabel::paintEvent(QPaintEvent * /*event*/)
{
QPainter painter(this);
#ifdef _WIN32
QString font1String = "font-family: \"Arial\";";
#else
#ifdef __APPLE__
QString font1String = "font-family: \"Lucida Grande\";";
#else
QString font1String = "font-family: \"Nimbus Sans L\";";
#endif
#else
#ifdef __APPLE__
QString font1String = "font-family: \"Lucida Grande\";";
#else
QString font1String = "font-family: \"Nimbus Sans L\";";
#endif
#endif
QFont font;
font.setFamily(font1String);
@@ -95,56 +96,86 @@ void MyChanceLabel::paintEvent(QPaintEvent * /*event*/) {
QColor possible("#"+myStyle->getChanceLabelPossibleColor());
QColor impossible("#"+myStyle->getChanceLabelImpossibleColor());
if(RFChance[1] == 0) { painter.setPen(impossible); }
else { painter.setPen(possible); }
if(RFChance[1] == 0) {
painter.setPen(impossible);
} else {
painter.setPen(possible);
}
painter.drawText(QRectF(QPointF(2,0), QPointF(85,13)),Qt::AlignRight,"Royal Flush");
painter.drawText(QRectF(QPointF(196,0), QPointF(236,13)),Qt::AlignRight,QString("%1%").arg(RFChance[0]));
if(SFChance[1] == 0) { painter.setPen(impossible); }
else { painter.setPen(possible); }
if(SFChance[1] == 0) {
painter.setPen(impossible);
} else {
painter.setPen(possible);
}
painter.drawText(QRectF(QPointF(2,13), QPointF(85,26)),Qt::AlignRight,"Straight Flush");
painter.drawText(QRectF(QPointF(196,13), QPointF(236,26)),Qt::AlignRight,QString("%1%").arg(SFChance[0]));
if(FOAKChance[1] == 0) { painter.setPen(impossible); }
else { painter.setPen(possible); }
if(FOAKChance[1] == 0) {
painter.setPen(impossible);
} else {
painter.setPen(possible);
}
painter.drawText(QRectF(QPointF(2,26), QPointF(85,39)),Qt::AlignRight,"Four of a Kind");
painter.drawText(QRectF(QPointF(196,26), QPointF(236,39)),Qt::AlignRight,QString("%1%").arg(FOAKChance[0]));
if(FHChance[1] == 0) { painter.setPen(impossible); }
else { painter.setPen(possible); }
if(FHChance[1] == 0) {
painter.setPen(impossible);
} else {
painter.setPen(possible);
}
painter.drawText(QRectF(QPointF(2,39), QPointF(85,52)),Qt::AlignRight,"Full House");
painter.drawText(QRectF(QPointF(196,39), QPointF(236,52)),Qt::AlignRight,QString("%1%").arg(FHChance[0]));
if(FLChance[1] == 0) { painter.setPen(impossible); }
else { painter.setPen(possible); }
if(FLChance[1] == 0) {
painter.setPen(impossible);
} else {
painter.setPen(possible);
}
painter.drawText(QRectF(QPointF(2,52), QPointF(85,65)),Qt::AlignRight,"Flush");
painter.drawText(QRectF(QPointF(196,52), QPointF(236,65)),Qt::AlignRight,QString("%1%").arg(FLChance[0]));
if(STRChance[1] == 0) { painter.setPen(impossible); }
else { painter.setPen(possible); }
if(STRChance[1] == 0) {
painter.setPen(impossible);
} else {
painter.setPen(possible);
}
painter.drawText(QRectF(QPointF(2,65), QPointF(85,78)),Qt::AlignRight,"Straight");
painter.drawText(QRectF(QPointF(196,65), QPointF(236,78)),Qt::AlignRight,QString("%1%").arg(STRChance[0]));
if(TOAKChance[1] == 0) { painter.setPen(impossible); }
else { painter.setPen(possible); }
if(TOAKChance[1] == 0) {
painter.setPen(impossible);
} else {
painter.setPen(possible);
}
painter.drawText(QRectF(QPointF(2,78), QPointF(85,91)),Qt::AlignRight,"Three of a Kind");
painter.drawText(QRectF(QPointF(196,78), QPointF(236,91)),Qt::AlignRight,QString("%1%").arg(TOAKChance[0]));
if(TPChance[1] == 0) { painter.setPen(impossible); }
else { painter.setPen(possible); }
if(TPChance[1] == 0) {
painter.setPen(impossible);
} else {
painter.setPen(possible);
}
painter.drawText(QRectF(QPointF(2,91), QPointF(85,104)),Qt::AlignRight,"Two Pairs");
painter.drawText(QRectF(QPointF(196,91), QPointF(236,104)),Qt::AlignRight,QString("%1%").arg(TPChance[0]));
if(OPChance[1] == 0) { painter.setPen(impossible); }
else { painter.setPen(possible); }
if(OPChance[1] == 0) {
painter.setPen(impossible);
} else {
painter.setPen(possible);
}
painter.drawText(QRectF(QPointF(2,104), QPointF(85,117)),Qt::AlignRight,"One Pair");
painter.drawText(QRectF(QPointF(196,104), QPointF(236,117)),Qt::AlignRight,QString("%1%").arg(OPChance[0]));
if(HCChance[1] == 0) { painter.setPen(impossible); }
else { painter.setPen(possible); }
if(HCChance[1] == 0) {
painter.setPen(impossible);
} else {
painter.setPen(possible);
}
painter.drawText(QRectF(QPointF(2,117), QPointF(85,130)),Qt::AlignRight,"Highest Card");
painter.drawText(QRectF(QPointF(196,117), QPointF(236,130)),Qt::AlignRight,QString("%1%").arg(HCChance[0]));
//Draw gfx
painter.setPen(QColor(0,0,0));
QLinearGradient linearGrad(QPointF(89,3), QPointF(190,10));
linearGrad.setColorAt(0, Qt::blue);
linearGrad.setColorAt(0.5, Qt::yellow);
linearGrad.setColorAt(1, Qt::red);
painter.setBrush(linearGrad);
if(RFChance[1] != 0) painter.drawRect(89,3,(108*RFChance[0])/100,7);
if(SFChance[1] != 0) painter.drawRect(89,16,(108*SFChance[0])/100,7);
if(FOAKChance[1] != 0) painter.drawRect(89,29,(108*FOAKChance[0])/100,7);
+13 -9
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -22,19 +22,23 @@ class GameTableStyleReader;
class MyChanceLabel : public QLabel
{
Q_OBJECT
Q_OBJECT
public:
MyChanceLabel(QWidget*);
MyChanceLabel(QWidget*);
~MyChanceLabel();
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
void setMyStyle ( GameTableStyleReader* theValue ) { myStyle = theValue; }
~MyChanceLabel();
void setMyW ( gameTableImpl* theValue ) {
myW = theValue;
}
void setMyStyle ( GameTableStyleReader* theValue ) {
myStyle = theValue;
}
void paintEvent(QPaintEvent * event);
void refreshChance(std::vector< std::vector<int> >);
void resetChance();
private:
private:
gameTableImpl *myW;
GameTableStyleReader *myStyle;
+23 -9
View File
@@ -1,7 +1,7 @@
//
// C++ Implementation: MyLeftTabWidget
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -12,7 +12,7 @@
#include "mylefttabwidget.h"
MyLeftTabWidget::MyLeftTabWidget(QGroupBox *parent)
: QTabWidget(parent), chatBlinkTimer(0), myTabBar(0)
: QTabWidget(parent), chatBlinkTimer(0), myTabBar(0)
{
myTabBar = this->tabBar();
@@ -25,19 +25,33 @@ 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::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() {
void MyLeftTabWidget::blinkChatTab()
{
//TODO doesnt work while stylesheet is set :(
// 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) {
void MyLeftTabWidget::paintEvent(QPaintEvent * event)
{
QTabWidget::paintEvent(event);
}
+9 -7
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: MyLeftTabWidget
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -18,11 +18,11 @@
class MyLeftTabWidget : public QTabWidget
{
Q_OBJECT
Q_OBJECT
public:
MyLeftTabWidget(QGroupBox*);
MyLeftTabWidget(QGroupBox*);
~MyLeftTabWidget();
~MyLeftTabWidget();
void paintEvent(QPaintEvent * event);
@@ -32,12 +32,14 @@ public:
void disableTab(int tabIndex, bool yesNO);
public slots:
void blinkChatTab();
QTabBar* getMyTabBar() const { return myTabBar; }
QTabBar* getMyTabBar() const {
return myTabBar;
}
private:
private:
QTimer *chatBlinkTimer;
QTabBar *myTabBar;
+6 -5
View File
@@ -1,15 +1,16 @@
#include "mymenubar.h"
MyMenuBar::MyMenuBar(QMainWindow* parent)
: QMenuBar(parent)
: QMenuBar(parent)
{
#if (QT_VERSION >= 0x040501)
this->setAttribute(Qt::WA_TranslucentBackground);
this->setStyleSheet("QMenuBar { border-width: 0px; border-style: none;} ");
#endif
this->setStyleSheet("QMenuBar { border-width: 0px; border-style: none;} ");
#endif
}
void MyMenuBar::paintEvent(QPaintEvent *e) {
void MyMenuBar::paintEvent(QPaintEvent *e)
{
QMenuBar::paintEvent(e);
QMenuBar::paintEvent(e);
}
+3 -3
View File
@@ -6,11 +6,11 @@
class MyMenuBar : public QMenuBar
{
Q_OBJECT
Q_OBJECT
public:
MyMenuBar(QMainWindow*);
MyMenuBar(QMainWindow*);
void paintEvent(QPaintEvent * event);
void paintEvent(QPaintEvent * event);
};
#endif
+32 -33
View File
@@ -1,7 +1,7 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -15,7 +15,7 @@
#include "gametablestylereader.h"
MyNameLabel::MyNameLabel(QGroupBox* parent)
: QLabel(parent), myW(0)
: QLabel(parent), myW(0)
{
}
@@ -24,44 +24,43 @@ MyNameLabel::~MyNameLabel()
{
}
void MyNameLabel::setText ( const QString &t, bool trans, bool guest, bool computerplayer) {
void MyNameLabel::setText ( const QString &t, bool trans, bool guest, bool computerplayer)
{
QString text;
QColor transColor;
transColor.setNamedColor("#"+myW->getMyGameTableStyle()->getPlayerNickTextColor());
QString red = QString::number(transColor.red());
QString green = QString::number(transColor.green());
QString blue = QString::number(transColor.blue());
QString text;
QColor transColor;
transColor.setNamedColor("#"+myW->getMyGameTableStyle()->getPlayerNickTextColor());
QString red = QString::number(transColor.red());
QString green = QString::number(transColor.green());
QString blue = QString::number(transColor.blue());
if(trans) {
this->setStyleSheet("QLabel { "+ myW->getMyGameTableStyle()->getFont2String() +" font-size: "+myW->getMyGameTableStyle()->getPlayerNameLabelFontSize()+"px; font-weight: bold; color: rgba("+red+", "+green+", "+blue+", 80); }");
}
else {
this->setStyleSheet("QLabel { "+ myW->getMyGameTableStyle()->getFont2String() +" font-size: "+myW->getMyGameTableStyle()->getPlayerNameLabelFontSize()+"px; font-weight: bold; color: #"+myW->getMyGameTableStyle()->getPlayerNickTextColor()+"; }");
}
if(trans) {
this->setStyleSheet("QLabel { "+ myW->getMyGameTableStyle()->getFont2String() +" font-size: "+myW->getMyGameTableStyle()->getPlayerNameLabelFontSize()+"px; font-weight: bold; color: rgba("+red+", "+green+", "+blue+", 80); }");
} else {
this->setStyleSheet("QLabel { "+ myW->getMyGameTableStyle()->getFont2String() +" font-size: "+myW->getMyGameTableStyle()->getPlayerNameLabelFontSize()+"px; font-weight: bold; color: #"+myW->getMyGameTableStyle()->getPlayerNickTextColor()+"; }");
}
if(myW->getSession()) {
if(myW->getSession()) {
if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET && !guest && !computerplayer ) {
if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET && !guest && !computerplayer ) {
// for internet game show players name with links to their profile included
this->setTextFormat(Qt::RichText);
QString linkString = QString("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(t));
this->setTextFormat(Qt::RichText);
QString linkString = QString("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(t));
if(trans) {
text = "<a style='color: rgba("+red+", "+green+", "+blue+", 80);' href='"+linkString+"'>"+t+"</a>";
}
else {
text = "<a style='color: #"+myW->getMyGameTableStyle()->getPlayerNickTextColor()+";' href='"+linkString+"'>"+t+"</a>";
}
if(trans) {
text = "<a style='color: rgba("+red+", "+green+", "+blue+", 80);' href='"+linkString+"'>"+t+"</a>";
} else {
text = "<a style='color: #"+myW->getMyGameTableStyle()->getPlayerNickTextColor()+";' href='"+linkString+"'>"+t+"</a>";
}
}
else {
this->setTextFormat(Qt::PlainText);
text = t;
}
}
else { text = t; }
} else {
this->setTextFormat(Qt::PlainText);
text = t;
}
} else {
text = t;
}
QLabel::setText(text);
QLabel::setText(text);
}
+10 -8
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -21,20 +21,22 @@ class gameTableImpl;
class MyNameLabel : public QLabel
{
Q_OBJECT
Q_OBJECT
public:
MyNameLabel(QGroupBox*);
~MyNameLabel();
MyNameLabel(QGroupBox*);
~MyNameLabel();
void setMyW(gameTableImpl* theValue) { myW = theValue; }
void setMyW(gameTableImpl* theValue) {
myW = theValue;
}
public slots:
void setText ( const QString &, bool = FALSE, bool = FALSE, bool = FALSE);
void setText ( const QString &, bool = FALSE, bool = FALSE, bool = FALSE);
private:
QString myText;
gameTableImpl *myW;
QString myText;
gameTableImpl *myW;
};
+5 -4
View File
@@ -1,7 +1,7 @@
//
// C++ Implementation: MyRightTabWidget
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -15,7 +15,7 @@
using namespace std;
MyRightTabWidget::MyRightTabWidget(QGroupBox *parent)
: QTabWidget(parent), myTabBar(0)
: QTabWidget(parent), myTabBar(0)
{
myTabBar = this->tabBar();
}
@@ -24,10 +24,11 @@ MyRightTabWidget::~MyRightTabWidget()
{
}
void MyRightTabWidget::paintEvent(QPaintEvent * event) {
void MyRightTabWidget::paintEvent(QPaintEvent * event)
{
QTabWidget::paintEvent(event);
}
+10 -8
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: MyRightTabWidget
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -17,22 +17,24 @@
class MyRightTabWidget : public QTabWidget
{
Q_OBJECT
Q_OBJECT
public:
MyRightTabWidget(QGroupBox*);
MyRightTabWidget(QGroupBox*);
~MyRightTabWidget();
~MyRightTabWidget();
void paintEvent(QPaintEvent * event);
QTabBar* getMyTabBar() const { return myTabBar; }
QTabBar* getMyTabBar() const {
return myTabBar;
}
public slots:
private:
private:
QTabBar *myTabBar;
};
+5 -4
View File
@@ -1,7 +1,7 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -16,7 +16,7 @@
using namespace std;
MySetLabel::MySetLabel(QGroupBox* parent)
: QLabel(parent), myW(0)
: QLabel(parent), myW(0)
{
}
@@ -25,7 +25,8 @@ MySetLabel::~MySetLabel()
{
}
void MySetLabel::paintEvent(QPaintEvent * event) {
void MySetLabel::paintEvent(QPaintEvent * event)
{
QLabel::paintEvent(event);
QLabel::paintEvent(event);
}
+12 -10
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -21,21 +21,23 @@ class gameTableImpl;
class MySetLabel : public QLabel
{
Q_OBJECT
Q_OBJECT
public:
MySetLabel(QGroupBox*);
MySetLabel(QGroupBox*);
~MySetLabel();
~MySetLabel();
void setMyW ( gameTableImpl* theValue ) {
myW = theValue;
}
void paintEvent(QPaintEvent * event);
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
void paintEvent(QPaintEvent * event);
public slots:
private:
private:
gameTableImpl *myW;
gameTableImpl *myW;
};
+12 -17
View File
@@ -11,18 +11,15 @@ class Slider : public QSlider
public:
Slider( QWidget* parent = 0 )
: QSlider( parent )
{
: QSlider( parent ) {
}
Slider( Qt::Orientation orientation, QWidget* parent = 0 )
: QSlider( orientation, parent )
{
: QSlider( orientation, parent ) {
}
protected:
int pixelPosToRangeValue(int pos) const // getted from QSlider.cpp with little adapt
{
int pixelPosToRangeValue(int pos) const { // getted from QSlider.cpp with little adapt
QStyleOptionSlider opt;
initStyleOption(&opt);
QRect gr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, this);
@@ -41,24 +38,22 @@ protected:
return QStyle::sliderValueFromPosition(minimum(), maximum(), pos - sliderMin,
sliderMax - sliderMin, opt.upsideDown);
}
int pick(const QPoint &pt) const // getted from QSlider.cpp with little adapt
{
int pick(const QPoint &pt) const { // getted from QSlider.cpp with little adapt
return orientation() == Qt::Horizontal ? pt.x() : pt.y();
}
virtual void mousePressEvent( QMouseEvent* ev ) // getted from QSlider.cpp with little adapt
{
virtual void mousePressEvent( QMouseEvent* ev ) { // getted from QSlider.cpp with little adapt
if (maximum() == minimum() || (ev->buttons() ^ ev->button())) {
ev->ignore();
return;
}
#ifdef QT_KEYPAD_NAVIGATION
#ifdef QT_KEYPAD_NAVIGATION
if (QApplication::keypadNavigationEnabled())
setEditFocus(true);
#endif
#endif
ev->accept();
//if ((ev->button() & style()->styleHint(QStyle::SH_Slider_AbsoluteSetButtons)) == ev->button())
{
QStyleOptionSlider opt;
@@ -84,7 +79,7 @@ protected:
update(sr);
setSliderDown(true);
}
QSlider::mousePressEvent( ev ); // should not be needed but as we can't update private d pointer it's needed.
}
};
+12 -9
View File
@@ -1,7 +1,7 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -16,7 +16,8 @@
using namespace std;
MyStatusLabel::MyStatusLabel(QGroupBox* parent)
: QLabel(parent), myW(NULL), mousePress(false) {
: QLabel(parent), myW(NULL), mousePress(false)
{
mousePress = FALSE;
@@ -26,23 +27,25 @@ MyStatusLabel::~MyStatusLabel()
{
}
void MyStatusLabel::mousePressEvent(QMouseEvent * event) {
void MyStatusLabel::mousePressEvent(QMouseEvent * event)
{
if (!mousePress && objectName().contains("textLabel_Status0")) {
mousePress = TRUE;
myW->mouseOverFlipCards(TRUE);
mousePress = TRUE;
myW->mouseOverFlipCards(TRUE);
}
QLabel::mousePressEvent(event);
}
void MyStatusLabel::mouseReleaseEvent(QMouseEvent * event) {
void MyStatusLabel::mouseReleaseEvent(QMouseEvent * event)
{
if (mousePress && objectName().contains("textLabel_Status0")) {
mousePress = FALSE;
mousePress = FALSE;
myW->mouseOverFlipCards(FALSE);
}
}
QLabel::mouseReleaseEvent(event);
}
+11 -9
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -21,24 +21,26 @@ class gameTableImpl;
class MyStatusLabel : public QLabel
{
Q_OBJECT
Q_OBJECT
public:
MyStatusLabel(QGroupBox*);
MyStatusLabel(QGroupBox*);
~MyStatusLabel();
~MyStatusLabel();
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
void setMyW ( gameTableImpl* theValue ) {
myW = theValue;
}
void mousePressEvent ( QMouseEvent *);
void mouseReleaseEvent ( QMouseEvent *);
private:
private:
gameTableImpl *myW;
bool mousePress;
};
#endif
+24 -22
View File
@@ -1,7 +1,7 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -16,7 +16,7 @@
using namespace std;
MyTimeoutLabel::MyTimeoutLabel(QGroupBox* parent)
: QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0), waitFrames(0), timerIntervall(0), isBeep(0), isBeepPlayed(0)
: QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0), waitFrames(0), timerIntervall(0), isBeep(0), isBeepPlayed(0)
{
timeOutAnimationTimer = new QTimer;
@@ -29,10 +29,10 @@ MyTimeoutLabel::~MyTimeoutLabel()
{
}
void MyTimeoutLabel::startTimeOutAnimation(int secs, bool beep) {
void MyTimeoutLabel::startTimeOutAnimation(int secs, bool beep)
{
if (secs >= 4) // smaller timeouts may lead to errors/endless loops below
{
if (secs >= 4) { // smaller timeouts may lead to errors/endless loops below
isBeepPlayed = FALSE;
isBeep = beep;
@@ -49,8 +49,7 @@ void MyTimeoutLabel::startTimeOutAnimation(int secs, bool beep) {
if(secs <= 9 && secs >= 6) {
//fix inaccuracies caused by integer division
timerIntervall = timerIntervall + preTimerIntervall + 5;
}
else {
} else {
timerIntervall = timerIntervall + preTimerIntervall;
}
}
@@ -61,20 +60,22 @@ void MyTimeoutLabel::startTimeOutAnimation(int secs, bool beep) {
realTimer.reset();
realTimer.start();
// std::cout << timerIntervall << endl;
// std::cout << timerIntervall << endl;
timeOutAnimation = TRUE;
timeOutAnimationTimer->start(timerIntervall);
}
}
void MyTimeoutLabel::startTimeOutAnimationNow() {
void MyTimeoutLabel::startTimeOutAnimationNow()
{
timeOutAnimation = TRUE;
timeOutAnimationTimer->start(83);
}
void MyTimeoutLabel::stopTimeOutAnimation() {
void MyTimeoutLabel::stopTimeOutAnimation()
{
// timeOutAnimationKickOnTimer->stop();
timeOutAnimationTimer->stop();
@@ -82,24 +83,24 @@ void MyTimeoutLabel::stopTimeOutAnimation() {
update();
}
void MyTimeoutLabel::nextTimeOutAnimationFrame() {
void MyTimeoutLabel::nextTimeOutAnimationFrame()
{
if(timeOutAnimationWidth >=0) {
if(timeOutFrame > waitFrames) {
if(timeOutFrame > waitFrames) {
//play beep after waitFrames one time
if(isBeep && !isBeepPlayed) {
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 = 52-(((realTimerValue-3000)*52)/((timeOutValue-3)*1000));
timeOutAnimationWidth = 52-(((realTimerValue-3000)*52)/((timeOutValue-3)*1000));
}
timeOutFrame++;
update();
}
else {
} else {
stopTimeOutAnimation();
// no callback is called here.
// the server initiates any action required.
@@ -107,7 +108,8 @@ void MyTimeoutLabel::nextTimeOutAnimationFrame() {
}
void MyTimeoutLabel::paintEvent(QPaintEvent * event) {
void MyTimeoutLabel::paintEvent(QPaintEvent * event)
{
if(!timeOutAnimation || timeOutFrame <= waitFrames) {
QLabel::paintEvent(event);
@@ -116,15 +118,15 @@ void MyTimeoutLabel::paintEvent(QPaintEvent * event) {
if(timeOutAnimation && timeOutFrame > waitFrames) {
QPainter painter(this);
QLinearGradient linearGrad(QPointF(0, 10), QPointF(47, 10));
QLinearGradient linearGrad(QPointF(0, 10), QPointF(47, 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,1,timeOutAnimationWidth-1,8);
painter.drawRect(0,1,timeOutAnimationWidth-1,8);
}
}
+16 -14
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -23,32 +23,34 @@ class gameTableImpl;
class MyTimeoutLabel : public QLabel
{
Q_OBJECT
Q_OBJECT
public:
MyTimeoutLabel(QGroupBox*);
MyTimeoutLabel(QGroupBox*);
~MyTimeoutLabel();
~MyTimeoutLabel();
void setMyW ( gameTableImpl* theValue ) {
myW = theValue;
}
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
void startTimeOutAnimation(int secs, bool beep);
void stopTimeOutAnimation();
void paintEvent(QPaintEvent * event);
public slots:
void startTimeOutAnimationNow();
void nextTimeOutAnimationFrame();
private:
private:
gameTableImpl *myW;
QTimer *timeOutAnimationTimer;
QTimer *timeOutAnimationKickOnTimer;
// boost::shared_ptr<SDLPlayer> mySDLPlayer;
boost::timers::portable::microsec_timer realTimer;
@@ -63,8 +65,8 @@ private:
int timerIntervall;
bool isBeep;
bool isBeepPlayed;
};
#endif
@@ -20,9 +20,9 @@
#include "startsplash.h"
StartSplash::StartSplash(QPixmap &p)
: QSplashScreen(p)
: QSplashScreen(p)
{
QTimer::singleShot(3000, this, SLOT(closeThis()));
QTimer::singleShot(3000, this, SLOT(closeThis()));
}
@@ -30,4 +30,7 @@ StartSplash::~StartSplash()
{
}
void StartSplash::closeThis() { this->close(); }
void StartSplash::closeThis()
{
this->close();
}
@@ -1,7 +1,7 @@
//
// C++ Interface: startsplash
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -18,11 +18,11 @@
class StartSplash : public QSplashScreen
{
Q_OBJECT
Q_OBJECT
public:
StartSplash(QPixmap& p);
StartSplash(QPixmap& p);
~StartSplash();
~StartSplash();
public slots: