From 576eb4299a00bc053db35414406f46372a0f70f2 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:42:31 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kpoker/kpoker.cpp | 124 +++++++++++++++++++++++++++--------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'kpoker/kpoker.cpp') diff --git a/kpoker/kpoker.cpp b/kpoker/kpoker.cpp index 2956b42c..a6f51772 100644 --- a/kpoker/kpoker.cpp +++ b/kpoker/kpoker.cpp @@ -18,11 +18,11 @@ #include // QT includes -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // KDE includes #include @@ -159,11 +159,11 @@ CardImages *cardImages; // Class kpok -kpok::kpok(QWidget *parent, const char *name) - : QWidget(parent, name), +kpok::kpok(TQWidget *parent, const char *name) + : TQWidget(parent, name), m_game(&m_random) { - QString version; + TQString version; m_random.setSeed(0); @@ -178,7 +178,7 @@ kpok::kpok(QWidget *parent, const char *name) // ...and the rest to computer players. for (int unsigned i = 1; i < m_numPlayers; i++) - m_players[i].setName(QString("Computer %1").arg(i-1)); + m_players[i].setName(TQString("Computer %1").arg(i-1)); lastHandText = ""; @@ -237,78 +237,78 @@ void kpok::initWindow() m_blinkingBox = 0; // General font stuff. Define myFixedFont and wonFont. - QFont myFixedFont; + TQFont myFixedFont; myFixedFont.setPointSize(12); - QFont wonFont; + TQFont wonFont; wonFont.setPointSize(14); wonFont.setBold(true); - topLayout = new QVBoxLayout(this, BORDER); - QVBoxLayout* topInputLayout = new QVBoxLayout; + topLayout = new TQVBoxLayout(this, BORDER); + TQVBoxLayout* topInputLayout = new QVBoxLayout; topLayout->addLayout(topInputLayout); - QHBoxLayout* betLayout = new QHBoxLayout; + TQHBoxLayout* betLayout = new QHBoxLayout; inputLayout = new QHBoxLayout; inputLayout->addLayout(betLayout); topInputLayout->addLayout(inputLayout); // The draw button - drawButton = new QPushButton(this); + drawButton = new TQPushButton(this); drawButton->setText(i18n("&Deal")); - connect(drawButton, SIGNAL(clicked()), this, SLOT(drawClick())); + connect(drawButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(drawClick())); inputLayout->addWidget(drawButton); inputLayout->addStretch(1); // The waving text - QFont waveFont; + TQFont waveFont; waveFont.setPointSize(16); waveFont.setBold(true); - QFontMetrics tmp(waveFont); + TQFontMetrics tmp(waveFont); // The widget where the winner is announced. - mWonWidget = new QWidget(this); + mWonWidget = new TQWidget(this); inputLayout->addWidget(mWonWidget, 2); mWonWidget->setMinimumHeight(50); //FIXME hardcoded value for the wave mWonWidget->setMinimumWidth(tmp.width(i18n("You won %1").arg(KGlobal::locale()->formatMoney(100))) + 20); // workaround for width problem in wave - QHBoxLayout* wonLayout = new QHBoxLayout(mWonWidget); + TQHBoxLayout* wonLayout = new TQHBoxLayout(mWonWidget); wonLayout->setAutoAdd(true); - wonLabel = new QLabel(mWonWidget); + wonLabel = new TQLabel(mWonWidget); wonLabel->setFont(wonFont); wonLabel->setAlignment(AlignCenter); wonLabel->hide(); inputLayout->addStretch(1); // The pot view - potLabel = new QLabel(this); + potLabel = new TQLabel(this); potLabel->setFont(myFixedFont); - potLabel->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); + potLabel->setFrameStyle(TQFrame::WinPanel | TQFrame::Sunken); inputLayout->addWidget(potLabel, 0, AlignCenter); // Label widget in the lower left. - clickToHold = new QLabel(this); + clickToHold = new TQLabel(this); clickToHold->hide(); // Timers - blinkTimer = new QTimer(this); - connect( blinkTimer, SIGNAL(timeout()), SLOT(bTimerEvent()) ); + blinkTimer = new TQTimer(this); + connect( blinkTimer, TQT_SIGNAL(timeout()), TQT_SLOT(bTimerEvent()) ); - waveTimer = new QTimer(this); - connect( waveTimer, SIGNAL(timeout()), SLOT(waveTimerEvent()) ); + waveTimer = new TQTimer(this); + connect( waveTimer, TQT_SIGNAL(timeout()), TQT_SLOT(waveTimerEvent()) ); - drawTimer = new QTimer(this); - connect (drawTimer, SIGNAL(timeout()), SLOT(drawCardsEvent()) ); + drawTimer = new TQTimer(this); + connect (drawTimer, TQT_SIGNAL(timeout()), TQT_SLOT(drawCardsEvent()) ); // and now the betUp/Down Buttons betBox = new BetBox(this, 0); betLayout->addWidget(betBox); - connect(betBox, SIGNAL(betChanged(int)), this, SLOT(betChange(int))); - connect(betBox, SIGNAL(betAdjusted()), this, SLOT(adjustBet())); - connect(betBox, SIGNAL(fold()), this, SLOT(out())); + connect(betBox, TQT_SIGNAL(betChanged(int)), this, TQT_SLOT(betChange(int))); + connect(betBox, TQT_SIGNAL(betAdjusted()), this, TQT_SLOT(adjustBet())); + connect(betBox, TQT_SIGNAL(fold()), this, TQT_SLOT(out())); // some tips - QToolTip::add(drawButton, i18n("Continue the round")); - QToolTip::add(potLabel, i18n("The current pot")); + TQToolTip::add(drawButton, i18n("Continue the round")); + TQToolTip::add(potLabel, i18n("The current pot")); // Load all cards into pixmaps first -> in the constructor. cardImages = new CardImages(this, 0); @@ -644,7 +644,7 @@ void kpok::initPoker(unsigned int numPlayers) // // FIXME: Make CardWidget::toggleHeld() work. playerBox[0]->activateToggleHeld(); - connect(playerBox[0], SIGNAL(toggleHeld()), this, SLOT(toggleHeld())); + connect(playerBox[0], TQT_SIGNAL(toggleHeld()), this, TQT_SLOT(toggleHeld())); // hide some things playerBox[0]->showHelds(false); @@ -701,7 +701,7 @@ void kpok::updateLHLabel() } -void kpok::setHand(const QString& newHand, bool lastHand) +void kpok::setHand(const TQString& newHand, bool lastHand) { emit changeLastHand(newHand, lastHand); @@ -803,7 +803,7 @@ void kpok::displayWinner_Computer(PokerPlayer* winner, bool othersPassed) m_game.setDirty(); // Generate a string with winner info and show it. - QString label; + TQString label; if (winner->getHuman()) label = i18n("You won %1").arg(KGlobal::locale()->formatMoney(m_game.getPot())); else @@ -811,10 +811,10 @@ void kpok::displayWinner_Computer(PokerPlayer* winner, bool othersPassed) wonLabel->setText(label); // Start the waving motion of the text. - QFont waveFont; + TQFont waveFont; waveFont.setBold(true); waveFont.setPointSize(16); - QFontMetrics tmp(waveFont); + TQFontMetrics tmp(waveFont); mWonWidget->setMinimumWidth(tmp.width(label) + 20); // Play a suitable sound. @@ -1060,9 +1060,9 @@ void kpok::bTimerEvent() } -void kpok::displayWin(const QString& hand, int cashWon) +void kpok::displayWin(const TQString& hand, int cashWon) { - QString buf; + TQString buf; setHand(hand); m_game.getActivePlayer(0)->setCash(m_game.getActivePlayer(0)->getCash() @@ -1090,7 +1090,7 @@ void kpok::displayWin(const QString& hand, int cashWon) } -void kpok::paintEvent( QPaintEvent *) +void kpok::paintEvent( TQPaintEvent *) { /* NOTE: This was shamelessy stolen from the "hello world" example * coming with Qt Thanks to the Qt-Guys for doing such a cool @@ -1101,7 +1101,7 @@ void kpok::paintEvent( QPaintEvent *) return; } - QString txt = wonLabel->text(); + TQString txt = wonLabel->text(); wonLabel->hide(); static int sin_tbl[16] = { @@ -1111,17 +1111,17 @@ void kpok::paintEvent( QPaintEvent *) return; } - QFont wonFont; + TQFont wonFont; wonFont.setPointSize(18); wonFont.setBold(true); - QFontMetrics fm = QFontMetrics(wonFont); + TQFontMetrics fm = TQFontMetrics(wonFont); int w = fm.width(txt) + 20; int h = fm.height() * 2; while (w > mWonWidget->width() && wonFont.pointSize() > 6) {// > 6 for emergency abort... wonFont.setPointSize(wonFont.pointSize() - 1); - fm = QFontMetrics(wonFont); + fm = TQFontMetrics(wonFont); w = fm.width(txt) + 20; h = fm.height() * 2; } @@ -1130,7 +1130,7 @@ void kpok::paintEvent( QPaintEvent *) int pmy = 0; // int pmy = (playerBox[0]->x() + playerBox[0]->height() + 10) - h / 4; - QPixmap pm( w, h ); + TQPixmap pm( w, h ); pm.fill( mWonWidget, pmx, pmy ); if (fCount == -1) { /* clear area */ @@ -1138,18 +1138,18 @@ void kpok::paintEvent( QPaintEvent *) return; } - QPainter p; + TQPainter p; int x = 10; int y = h/2 + fm.descent(); unsigned int i = 0; p.begin( &pm ); p.setFont( wonFont ); - p.setPen( QColor(0,0,0) ); + p.setPen( TQColor(0,0,0) ); while ( i < txt.length() ) { int i16 = (fCount+i) & 15; - p.drawText( x, y-sin_tbl[i16]*h/800, QString(txt[i]), 1 ); + p.drawText( x, y-sin_tbl[i16]*h/800, TQString(txt[i]), 1 ); x += fm.width( txt[i] ); i++; } @@ -1307,9 +1307,9 @@ void kpok::saveGame(KConfig* conf) conf->writeEntry("lastHandText", lastHandText); for (int i = 0; i < players; i++) { - conf->writeEntry(QString("Name_%1").arg(i), m_players[i].getName()); - conf->writeEntry(QString("Human_%1").arg(i), m_players[i].getHuman()); - conf->writeEntry(QString("Cash_%1").arg(i), m_players[i].getCash()); + conf->writeEntry(TQString("Name_%1").arg(i), m_players[i].getName()); + conf->writeEntry(TQString("Human_%1").arg(i), m_players[i].getHuman()); + conf->writeEntry(TQString("Cash_%1").arg(i), m_players[i].getCash()); } m_game.clearDirty(); @@ -1360,10 +1360,10 @@ bool kpok::initSound() } -void kpok::playSound(const QString &soundname) +void kpok::playSound(const TQString &soundname) { if (sound) - KAudioPlayer::play(locate("data", QString("kpoker/sounds/")+soundname)); + KAudioPlayer::play(locate("data", TQString("kpoker/sounds/")+soundname)); } @@ -1407,14 +1407,14 @@ bool kpok::loadGame(KConfig* conf) if (numPlayers > 0) { for (int i = 0; i < numPlayers; i++) { - QString buf = conf->readEntry(QString("Name_%1").arg(i), + TQString buf = conf->readEntry(TQString("Name_%1").arg(i), "Player"); m_players[i].setName(buf); - bool human = conf->readBoolEntry(QString("Human_%1").arg(i), + bool human = conf->readBoolEntry(TQString("Human_%1").arg(i), false); if (human) m_players[i].setHuman(); // i == 0 - int cash = conf->readNumEntry(QString("Cash_%1").arg(i), + int cash = conf->readNumEntry(TQString("Cash_%1").arg(i), START_MONEY); m_players[i].setCash(cash); m_game.setDirty(); @@ -1451,15 +1451,15 @@ void kpok::exchangeCard5() { playerBox[0]->cardClicked(5); } void kpok::slotCardDeck() { kapp->config()->setGroup("General"); - QString deckPath = kapp->config()->readPathEntry("DeckPath", 0); - QString cardPath = kapp->config()->readPathEntry("CardPath", 0); + TQString deckPath = kapp->config()->readPathEntry("DeckPath", 0); + TQString cardPath = kapp->config()->readPathEntry("CardPath", 0); bool randomDeck, randomCardDir; // Show the "Select Card Deck" dialog and load the images for the // selected deck, if any. if (KCardDialog::getCardDeck(deckPath, cardPath, this, KCardDialog::Both, &randomDeck, &randomCardDir) - == QDialog::Accepted) { + == TQDialog::Accepted) { // Load backside and front images. if (playerBox && m_blinking && (m_blinkStat == 0)) -- cgit v1.2.1