next startwindow steps

This commit is contained in:
doitux
2008-06-08 10:50:08 +00:00
parent 0c98902905
commit 0cf73d2bc9
7 changed files with 38 additions and 291 deletions
+13 -13
View File
@@ -111,9 +111,9 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
}
//Intro abspielen?
if (myConfig->readConfigInt("ShowIntro")) {
// label_logo->hide();
QTimer::singleShot(100, this, SLOT( paintStartSplash() )); }
// if (myConfig->readConfigInt("ShowIntro")) {
// // label_logo->hide();
// QTimer::singleShot(100, this, SLOT( paintStartSplash() )); }
// userWidgetsArray init
userWidgetsArray[0] = pushButton_BetRaise;
@@ -3045,16 +3045,16 @@ void gameTableImpl::breakButtonClicked() {
void gameTableImpl::paintStartSplash() {
StartSplash *mySplash = new StartSplash(this, myConfig);
#ifdef __APPLE__
int offset = 305;
#else
int offset = 237;
#endif
mySplash->setGeometry(this->pos().x()+offset,this->pos().y()+210,400,250);
// mySplash->setWindowFlags(Qt::SplashScreen);
mySplash->show();
// StartSplash *mySplash = new StartSplash(this, myConfig);
//
// #ifdef __APPLE__
// int offset = 305;
// #else
// int offset = 237;
// #endif
// mySplash->setGeometry(this->pos().x()+offset,this->pos().y()+210,400,250);
// // mySplash->setWindowFlags(Qt::SplashScreen);
// mySplash->show();
}
@@ -19,25 +19,10 @@
***************************************************************************/
#include "startsplash.h"
#include "configfile.h"
#include "gametableimpl.h"
StartSplash::StartSplash(gameTableImpl *parent, ConfigFile *c)
: QSplashScreen(parent), myW(parent), myConfig(c)
StartSplash::StartSplash(QPixmap &p)
: QSplashScreen(p)
{
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
logo = myAppDataPath+"gfx/gui/misc/logoChip3D.png";
frameNo = 52;
opacityCounter = 13;
opacity = 1.0;
QTimer *timer = new QTimer;
connect(timer, SIGNAL(timeout()), this, SLOT(nextAnimationFrame()));
timer->start(40);
QTimer::singleShot(3000, this, SLOT(closeThis()));
}
@@ -45,238 +30,4 @@ StartSplash::~StartSplash()
{
}
void StartSplash::nextAnimationFrame() {
++frameNo;
update();
}
void StartSplash::paintEvent(QPaintEvent * /*event*/) {
QPainter painter(this);
#ifdef _WIN32
QFont welcomeFont;
welcomeFont.setFamily("Times New Roman");
welcomeFont.setPixelSize(42);
#else
#ifdef __APPLE__
QFont welcomeFont;
welcomeFont.setFamily("Century Schoolbook L");
welcomeFont.setPixelSize(42);
#else
QFont welcomeFont;
welcomeFont.setFamily("Century Schoolbook L");
welcomeFont.setPixelSize(35);
#endif
#endif
#ifdef __APPLE__
QFont haveFont;
haveFont.setFamily("Century Schoolbook L");
haveFont.setPixelSize(24);
#else
QFont haveFont;
haveFont.setFamily("Century Schoolbook L");
haveFont.setPixelSize(24);
#endif
QFont versionFont;
versionFont.setFamily("Nimbus Sans L");
versionFont.setPixelSize(12);
if(frameNo >= 52 && frameNo < 55) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
}
if(frameNo >= 55 && frameNo < 57) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"W");
}
if(frameNo >= 57 && frameNo < 59) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"We");
}
if(frameNo >= 59 && frameNo < 61) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Wel");
}
if(frameNo >= 61 && frameNo < 63) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welc");
}
if(frameNo >= 63 && frameNo < 65) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welco");
}
if(frameNo >= 65 && frameNo < 67) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcom");
}
if(frameNo >= 67 && frameNo < 72) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome");
}
if(frameNo >= 72 && frameNo < 74) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome t");
}
if(frameNo >= 74 && frameNo < 79 ) {
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome to");
}
if(frameNo >= 79 && frameNo < 91) {
//
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome to");
--opacityCounter;
// std::cout << opacity << " " << opacityCounter << "\n";
opacity = 1.0/opacityCounter;
// std::cout << opacity << "\n";
painter.setOpacity(opacity);
painter.drawPixmap(150,85,100,100,logo);
}
if(frameNo >= 91 && frameNo < 106) {
//
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome to");
painter.drawPixmap(150,85,100,100,logo);
}
if(frameNo >= 106 && frameNo < 136) {
//
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome to");
painter.drawPixmap(150,85,100,100,logo);
painter.setFont(haveFont);
painter.setPen(QColor(255,255,255));
painter.drawText(3,190,390,40,4,"Have a lot of fun!");
}
if(frameNo >= 136 && frameNo < 190) {
//
painter.setBrush(QColor(35,71,0));
painter.drawRect(0,0,399,249);
painter.setRenderHint(QPainter::Antialiasing, TRUE);
painter.setFont(welcomeFont);
painter.setPen(QColor(255,255,255));
painter.drawText(48,27,300,45,4,"Welcome to");
painter.drawPixmap(150,85,100,100,logo);
painter.setFont(haveFont);
painter.setPen(QColor(255,255,255));
painter.drawText(3,190,390,40,4,"Have a lot of fun! ;-)");
}
//even draw version number
painter.setOpacity(1.0);
painter.setFont(versionFont);
painter.setPen(QColor(153,213,0));
painter.drawText(309,227,100,20,4,QString("Version %1").arg(POKERTH_BETA_RELEASE_STRING));
painter.setOpacity(opacity);
if(frameNo >=190) {
this->close();
}
}
void StartSplash::closeThis() { this->close(); }
+3 -17
View File
@@ -15,32 +15,18 @@
#include <QtGui>
#include <QtCore>
class gameTableImpl;
class ConfigFile;
class StartSplash : public QSplashScreen
{
Q_OBJECT
public:
StartSplash(gameTableImpl *, ConfigFile*);
StartSplash(QPixmap& p);
~StartSplash();
int frameNo;
int opacityCounter;
qreal opacity;
void paintEvent(QPaintEvent * event);
public slots:
void nextAnimationFrame();
private:
gameTableImpl *myW;
QString myAppDataPath;
QPixmap logo;
ConfigFile *myConfig;
void closeThis();
};
+5 -1
View File
@@ -23,18 +23,22 @@
#include "log.h"
#include "chat.h"
#include "gametableimpl.h"
#include "startwindowimpl.h"
#include "configfile.h"
using namespace std;
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(0), myW(0), myConfig(c)
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(NULL), myW(NULL), myConfig(c), myStartWindow(NULL)
{
myW = new gameTableImpl(myConfig);
myW->show();
myLog = new Log(myW, myConfig);
myStartWindow = new startWindowImpl(myW, myConfig);
// myStartWindow-> show();
}
+2
View File
@@ -26,6 +26,7 @@
class Session;
class gameTableImpl;
class startWindowImpl;
class Log;
class Chat;
class ConfigFile;
@@ -146,6 +147,7 @@ private:
Chat *myChat;
gameTableImpl *myW;
ConfigFile *myConfig;
startWindowImpl *myStartWindow;
};
+11 -7
View File
@@ -18,18 +18,17 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/////// can be removed for non-qt-guis ////////////
#include <qapplication.h>
#ifdef __APPLE__
#include <QMacStyle>
#endif
///////////////////////////////////////////////////
#include "session.h"
#include "guiwrapper.h"
#include "startwindowimpl.h"
#include "configfile.h"
#include "startsplash.h"
#include "game_defs.h"
#include <net/socket_startup.h>
#include <curl/curl.h>
@@ -105,6 +104,12 @@ int main( int argc, char **argv )
// #endif
a.setStyleSheet("QApplication, QWidget, QDialog { " + font1String + " font-size: 12px; }");
#endif
QPixmap *pixmap = new QPixmap(myAppDataPath + "gfx/gui/misc/welcomepokerth.png");
StartSplash splash(*pixmap);
splash.show();
splash.showMessage(QString("Version %1").arg(POKERTH_BETA_RELEASE_STRING), 0x0042, QColor(153,213,0));
//Set translations
QTranslator qtTranslator;
qtTranslator.load(QString(myAppDataPath +"translations/qt_") + QString::fromStdString(myConfig->readConfigString("Language")));
@@ -134,12 +139,11 @@ int main( int argc, char **argv )
session->init(); // TODO handle error
myGuiInterface->setSession(session);
}
// boost::shared_ptr<startWindowImpl> myStartWindow(new startWindowImpl(myGuiInterface.get(), myConfig));
int retVal = a.exec();
curl_global_cleanup();
socket_cleanup();
return retVal;
}