From f9becff1964587b4858c5b0633834e74d7c530b1 Mon Sep 17 00:00:00 2001 From: doitux Date: Sat, 27 Jan 2007 01:20:51 +0000 Subject: [PATCH] --- src/gui/qt/mainwindowimpl.cpp | 38 +++++++++++++++++++++----- src/gui/qt/mainwindowimpl.h | 9 +++++- src/gui/qt/startsplash/startsplash.cpp | 35 ++++++++++-------------- src/gui/qt/startsplash/startsplash.h | 14 +++------- 4 files changed, 57 insertions(+), 39 deletions(-) diff --git a/src/gui/qt/mainwindowimpl.cpp b/src/gui/qt/mainwindowimpl.cpp index 9f0a0668..904eacc4 100755 --- a/src/gui/qt/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindowimpl.cpp @@ -50,6 +50,9 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name) { // Schriftart laden QFontDatabase::addApplicationFont ("src/gui/qt/fonts/n019003l.pfb"); + QFontDatabase::addApplicationFont ("src/gui/qt/fonts/c059013l.pfb"); + QFontDatabase::addApplicationFont ("src/gui/qt/fonts/andybold.ttf"); + QFont tmpFont("Nimbus Sans L",9); QApplication::setFont(tmpFont); @@ -65,6 +68,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name) setupUi(this); int i; + startSplashFrameNo = 0; //Toolbox verstecken? if (!myConfig->readConfigInt("ShowToolBox", 1)) { groupBox_tools->hide(); } @@ -99,7 +103,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name) userWidgetsArray[i]->setPalette(tempPalette); } - //Timer Objekt erstellen + //Timer Objekte erstellen dealFlopCards0Timer = new QTimer(this); dealFlopCards1Timer = new QTimer(this); dealFlopCards2Timer = new QTimer(this); @@ -132,6 +136,9 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name) potDistributeTimer = new QTimer(this); postRiverRunAnimation6Timer = new QTimer(this); + startSplashAnimationTimer = new QTimer(this); + + dealFlopCards0Timer->setSingleShot(TRUE); dealFlopCards1Timer->setSingleShot(TRUE); dealFlopCards2Timer->setSingleShot(TRUE); @@ -261,6 +268,8 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name) connect(potDistributeTimer, SIGNAL(timeout()), this, SLOT(postRiverRunAnimation5())); connect(postRiverRunAnimation5Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation6() )); connect(postRiverRunAnimation6Timer, SIGNAL(timeout()), this, SLOT( startNewHand() )); + + connect(startSplashAnimationTimer, SIGNAL(timeout()), this, SLOT( startSplashNextFrame() )); connect( actionNewGame, SIGNAL( activated() ), this, SLOT( callNewGameDialog() ) ); connect( actionAboutPokerth, SIGNAL( activated() ), this, SLOT( callAboutPokerthDialog() ) ); @@ -1245,6 +1254,12 @@ void mainWindowImpl::postRiverRunAnimation6() { postRiverRunAnimation6Timer->start(newRoundSpeed); } +void mainWindowImpl::startSplashNextFrame() { + + ++startSplashFrameNo; + update(); + +} void mainWindowImpl::startNewHand() { @@ -1384,17 +1399,18 @@ void mainWindowImpl::breakButtonClicked() { void mainWindowImpl::paintStartSplash() { - StartSplash *mySplash = new StartSplash(this->geometry()); - - mySplash->setGeometry(0,0,400,250); - mySplash->setWindowFlags(Qt::SplashScreen); - mySplash->show(); +// std::cout << this->geometry().x() << this->geometry().y() << "\n"; + +/* + StartSplash *mySplash = new StartSplash(this); + + mySplash->show();*/ } void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) { -// cout << event->key() << endl; + cout << event->key() << endl; if (event->key() == 16777265) { switchToolBox(); } @@ -1409,6 +1425,14 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) { } +void mainWindowImpl::paintEvent(QPaintEvent* event) { + QMainWindow::paintEvent(event); + StartSplash startSplashPainter(this); + startSplashPainter.setFrameNo(startSplashFrameNo); + /* do your overlay painting here */ +} + + void mainWindowImpl::switchToolBox() { if (groupBox_tools->isHidden()) { groupBox_tools->show(); } diff --git a/src/gui/qt/mainwindowimpl.h b/src/gui/qt/mainwindowimpl.h index 03ca36d0..9ebe0376 100755 --- a/src/gui/qt/mainwindowimpl.h +++ b/src/gui/qt/mainwindowimpl.h @@ -136,6 +136,8 @@ public slots: void postRiverRunAnimation5(); void postRiverRunAnimation6(); + void startSplashNextFrame(); + void handSwitchRounds(); void startNewHand(); @@ -148,8 +150,9 @@ public slots: void breakButtonClicked(); void keyPressEvent ( QKeyEvent * event ); + void paintEvent(QPaintEvent* event); + void switchToolBox(); - void paintStartSplash(); private: @@ -193,6 +196,9 @@ private: QTimer *postRiverRunAnimation3Timer; QTimer *postRiverRunAnimation5Timer; QTimer *postRiverRunAnimation6Timer; + + QTimer *startSplashAnimationTimer; + QWidget *userWidgetsArray[8]; QLabel *buttonLabelArray[5]; @@ -207,6 +213,7 @@ private: int maxQuantityPlayers; int distributePotAnimCounter; + int startSplashFrameNo; //Speed int guiGameSpeed; diff --git a/src/gui/qt/startsplash/startsplash.cpp b/src/gui/qt/startsplash/startsplash.cpp index e3329c4b..ead87986 100644 --- a/src/gui/qt/startsplash/startsplash.cpp +++ b/src/gui/qt/startsplash/startsplash.cpp @@ -19,19 +19,13 @@ ***************************************************************************/ #include "startsplash.h" -StartSplash::StartSplash(const QRect &rect) - : QWidget(), parentsGeo(rect) +StartSplash::StartSplash(QMainWindow *parent) + : QPainter() { - QFontDatabase::addApplicationFont ("src/gui/qt/fonts/c059013l.pfb"); - QFontDatabase::addApplicationFont ("src/gui/qt/fonts/andybold.ttf"); - frameNo = 52; opacityCounter = 13; opacity = 1.0; - - QTimer *timer = new QTimer; - connect(timer, SIGNAL(timeout()), this, SLOT(nextAnimationFrame())); - timer->start(40); + } @@ -39,25 +33,18 @@ StartSplash::~StartSplash() { } -void StartSplash::nextAnimationFrame() { - - ++frameNo; - update(); - } +void StartSplash::aanimateStartSplash() { -void StartSplash::paintEvent(QPaintEvent * event) { - - QPainter painter(this); QFont welcomeFont("Century Schoolbook L",29); QFont haveFont("Andy MT",30); QPixmap logo(":/graphics/graphics/logo-140-100.png"); if(frameNo >= 52 && frameNo < 65) { - painter.setBrush(QColor(40,80,46)); - painter.drawRect(0,0,399,249); + setBrush(QColor(40,80,46)); + drawRect(0,0,399,249); } - +/* if(frameNo >= 65 && frameNo < 68) { painter.setBrush(QColor(40,80,46)); @@ -236,7 +223,13 @@ void StartSplash::paintEvent(QPaintEvent * event) { } - if(frameNo >= 260 ) { this->hide(); } + if(frameNo >= 260 ) { this->hide(); }*/ } +/* +void StartSplash::mousePressEvent ( QMouseEvent * event ) { + + if(event) this->hide(); + +}*/ diff --git a/src/gui/qt/startsplash/startsplash.h b/src/gui/qt/startsplash/startsplash.h index e1edab99..b06c8f4a 100644 --- a/src/gui/qt/startsplash/startsplash.h +++ b/src/gui/qt/startsplash/startsplash.h @@ -17,11 +17,11 @@ #include #include -class StartSplash : public QWidget +class StartSplash : public QPainter { Q_OBJECT public: - StartSplash(const QRect&); + StartSplash(QMainWindow *parent = 0); ~StartSplash(); @@ -29,14 +29,8 @@ public: int opacityCounter; qreal opacity; - QRect parentsGeo; - - void paintEvent(QPaintEvent * event); - -public slots: - - void nextAnimationFrame(); - + void aanimateStartSplash(); + void setFrameNo(int frameNumber) { frameNo = frameNumber+51; } }; #endif