diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:58:26 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:58:26 +0000 |
commit | 838baf3f99ec5ab81b063eb5449a3381d860f377 (patch) | |
tree | dd31abcfde08ca92e4623b8f50b3d762a87c997a /kpat/dealer.cpp | |
parent | 2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff) | |
download | tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip |
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpat/dealer.cpp')
-rw-r--r-- | kpat/dealer.cpp | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/kpat/dealer.cpp b/kpat/dealer.cpp index 365e7411..d53b7d3a 100644 --- a/kpat/dealer.cpp +++ b/kpat/dealer.cpp @@ -99,7 +99,7 @@ const Dealer *Dealer::instance() void Dealer::setBackgroundPixmap(const TQPixmap &background, const TQColor &midcolor) { _midcolor = midcolor; - canvas()->setBackgroundPixmap(background); + canvas()->tqsetBackgroundPixmap(background); for (PileList::Iterator it = piles.begin(); it != piles.end(); ++it) { (*it)->resetCache(); (*it)->initSizes(); @@ -114,30 +114,30 @@ void Dealer::setupActions() { if (actions() & Dealer::Hint) { - ahint = new KAction( i18n("&Hint"), TQString::fromLatin1("wizard"), Key_H, this, + ahint = new KAction( i18n("&Hint"), TQString::tqfromLatin1("wizard"), Key_H, TQT_TQOBJECT(this), TQT_SLOT(hint()), - parent()->actionCollection(), "game_hint"); + tqparent()->actionCollection(), "game_hint"); actionlist.append(ahint); } else ahint = 0; if (actions() & Dealer::Demo) { - ademo = new KToggleAction( i18n("&Demo"), TQString::fromLatin1("1rightarrow"), CTRL+Key_D, this, + ademo = new KToggleAction( i18n("&Demo"), TQString::tqfromLatin1("1rightarrow"), CTRL+Key_D, TQT_TQOBJECT(this), TQT_SLOT(toggleDemo()), - parent()->actionCollection(), "game_demo"); + tqparent()->actionCollection(), "game_demo"); actionlist.append(ademo); } else ademo = 0; if (actions() & Dealer::Redeal) { - aredeal = new KAction (i18n("&Redeal"), TQString::fromLatin1("queue"), 0, this, + aredeal = new KAction (i18n("&Redeal"), TQString::tqfromLatin1("queue"), 0, TQT_TQOBJECT(this), TQT_SLOT(redeal()), - parent()->actionCollection(), "game_redeal"); + tqparent()->actionCollection(), "game_redeal"); actionlist.append(aredeal); } else aredeal = 0; - parent()->guiFactory()->plugActionList( parent(), TQString::fromLatin1("game_actions"), actionlist); + tqparent()->guiFactory()->plugActionList( tqparent(), TQString::tqfromLatin1("game_actions"), actionlist); } Dealer::~Dealer() @@ -145,7 +145,7 @@ Dealer::~Dealer() if (!_won) countLoss(); clearHints(); - parent()->guiFactory()->unplugActionList( parent(), TQString::fromLatin1("game_actions")); + tqparent()->guiFactory()->unplugActionList( tqparent(), TQString::tqfromLatin1("game_actions")); while (!piles.isEmpty()) delete piles.first(); // removes itself @@ -154,9 +154,9 @@ Dealer::~Dealer() s_instance = 0; } -KMainWindow *Dealer::parent() const +KMainWindow *Dealer::tqparent() const { - return dynamic_cast<KMainWindow*>(TQCanvasView::parent()); + return dynamic_cast<KMainWindow*>(TQCanvasView::tqparent()); } @@ -249,7 +249,7 @@ void Dealer::newHint(MoveHint *mh) bool Dealer::isMoving(Card *c) const { - return movingCards.find(c) != movingCards.end(); + return movingCards.tqfind(c) != movingCards.end(); } void Dealer::contentsMouseMoveEvent(TQMouseEvent* e) @@ -277,13 +277,13 @@ void Dealer::contentsMouseMoveEvent(TQMouseEvent* e) continue; if (c->source() == movingCards.first()->source()) continue; - if (sources.findIndex(c->source()) != -1) + if (sources.tqfindIndex(c->source()) != -1) continue; sources.append(c->source()); } else { if ((*it)->rtti() == Pile::RTTI) { Pile *p = static_cast<Pile*>(*it); - if (p->isEmpty() && !sources.contains(p)) + if (p->isEmpty() && !sources.tqcontains(p)) sources.append(p); } else { kdDebug(11111) << "unknown object " << *it << " " << (*it)->rtti() << endl; @@ -314,7 +314,7 @@ void Dealer::contentsMouseMoveEvent(TQMouseEvent* e) void Dealer::mark(Card *c) { c->setSelected(true); - if (!marked.contains(c)) + if (!marked.tqcontains(c)) marked.append(c); } @@ -342,7 +342,7 @@ void Dealer::contentsMousePressEvent(TQMouseEvent* e) if (!list.count()) return; - if (e->button() == LeftButton) { + if (e->button() == Qt::LeftButton) { if (list.first()->rtti() == Card::RTTI) { Card *c = dynamic_cast<Card*>(list.first()); assert(c); @@ -355,7 +355,7 @@ void Dealer::contentsMousePressEvent(TQMouseEvent* e) return; } - if (e->button() == RightButton) { + if (e->button() == Qt::RightButton) { if (list.first()->rtti() == Card::RTTI) { Card *preview = dynamic_cast<Card*>(list.first()); assert(preview); @@ -535,8 +535,8 @@ void Dealer::resizeEvent(TQResizeEvent *e) { int x = width(); int y = height(); - int hs = horizontalScrollBar()->sizeHint().height(); - int vs = verticalScrollBar()->sizeHint().width(); + int hs = horizontalScrollBar()->tqsizeHint().height(); + int vs = verticalScrollBar()->tqsizeHint().width(); int mx = minsize.width(); int my = minsize.height(); @@ -735,7 +735,7 @@ State *Dealer::getState() s.it = c; s.source = c->source(); if (!s.source) { - kdDebug(11111) << c->name() << " has no parent\n"; + kdDebug(11111) << c->name() << " has no tqparent\n"; assert(false); } s.source_index = c->source()->indexOf(c); @@ -778,7 +778,7 @@ void Dealer::setState(State *st) CardState s = *it; bool target = c->takenDown(); // abused s.source->add(c, s.source_index); - c->setVisible(s.source->isVisible()); + c->tqsetVisible(s.source->isVisible()); c->setAnimated(false); c->setX(s.x); c->setY(s.y); @@ -827,13 +827,13 @@ void Dealer::takeState() ademo->setEnabled( false ); if ( aredeal ) aredeal->setEnabled( false ); - TQTimer::singleShot(400, this, TQT_SIGNAL(gameLost())); + TQTimer::singleShot(400, TQT_TQOBJECT(this), TQT_SIGNAL(gameLost())); toldAboutLostGame = true; return; } } if (!demoActive() && !waiting()) - TQTimer::singleShot(TIME_BETWEEN_MOVES, this, TQT_SLOT(startAutoDrop())); + TQTimer::singleShot(TIME_BETWEEN_MOVES, TQT_TQOBJECT(this), TQT_SLOT(startAutoDrop())); emit undoPossible(undoList.count() > 1 && !waiting()); } @@ -962,7 +962,7 @@ void Dealer::openGame(TQDomDocument &doc) (*it2)->setX(card.attribute("x").toInt()); (*it2)->setY(card.attribute("y").toInt()); (*it2)->setZ(card.attribute("z").toInt()); - (*it2)->setVisible(p->isVisible()); + (*it2)->tqsetVisible(p->isVisible()); cards.remove(it2); break; } @@ -1034,7 +1034,7 @@ void Dealer::setWaiting(bool w) void Dealer::setAutoDropEnabled(bool a) { _autodrop = a; - TQTimer::singleShot(TIME_BETWEEN_MOVES, this, TQT_SLOT(startAutoDrop())); + TQTimer::singleShot(TIME_BETWEEN_MOVES, TQT_TQOBJECT(this), TQT_SLOT(startAutoDrop())); } bool Dealer::startAutoDrop() @@ -1046,7 +1046,7 @@ bool Dealer::startAutoDrop() for (TQCanvasItemList::ConstIterator it = list.begin(); it != list.end(); ++it) if ((*it)->animated()) { - TQTimer::singleShot(TIME_BETWEEN_MOVES, this, TQT_SLOT(startAutoDrop())); + TQTimer::singleShot(TIME_BETWEEN_MOVES, TQT_TQOBJECT(this), TQT_SLOT(startAutoDrop())); return true; } @@ -1160,14 +1160,14 @@ void Dealer::won() { // wrap in own scope to make KConfigGroupSave work KConfig *config = kapp->config(); KConfigGroupSaver kcs(config, scores_group); - unsigned int n = config->readUnsignedNumEntry(TQString("won%1").arg(_id),0) + 1; - config->writeEntry(TQString("won%1").arg(_id),n); - n = config->readUnsignedNumEntry(TQString("winstreak%1").arg(_id),0) + 1; - config->writeEntry(TQString("winstreak%1").arg(_id),n); - unsigned int m = config->readUnsignedNumEntry(TQString("maxwinstreak%1").arg(_id),0); + unsigned int n = config->readUnsignedNumEntry(TQString("won%1").tqarg(_id),0) + 1; + config->writeEntry(TQString("won%1").tqarg(_id),n); + n = config->readUnsignedNumEntry(TQString("winstreak%1").tqarg(_id),0) + 1; + config->writeEntry(TQString("winstreak%1").tqarg(_id),n); + unsigned int m = config->readUnsignedNumEntry(TQString("maxwinstreak%1").tqarg(_id),0); if (n>m) - config->writeEntry(TQString("maxwinstreak%1").arg(_id),n); - config->writeEntry(TQString("loosestreak%1").arg(_id),0); + config->writeEntry(TQString("maxwinstreak%1").tqarg(_id),n); + config->writeEntry(TQString("loosestreak%1").tqarg(_id),0); } // sort cards by increasing z @@ -1348,7 +1348,7 @@ void Dealer::drawPile(KPixmap &pixmap, Pile *pile, bool selected) TQRect bounding(int(pile->x()), int(pile->y()), cardMap::CARDX(), cardMap::CARDY()); pixmap.resize(bounding.width(), bounding.height()); - pixmap.fill(Qt::white); + pixmap.fill(TQt::white); if (!bg.isNull()) { for (int x=bounding.x()/bg.width(); @@ -1371,8 +1371,8 @@ void Dealer::drawPile(KPixmap &pixmap, Pile *pile, bool selected) sy = -dy; dy = 0; } - bitBlt(&pixmap, dx, dy, &bg, - sx, sy, w, h, Qt::CopyROP, true); + bitBlt(TQT_TQPAINTDEVICE(&pixmap), dx, dy, TQT_TQPAINTDEVICE(&bg), + sx, sy, w, h, TQt::CopyROP, true); } } } @@ -1381,7 +1381,7 @@ void Dealer::drawPile(KPixmap &pixmap, Pile *pile, bool selected) float s = -0.4; float n = -0.3; - int mid = QMAX( QMAX(midColor().red(), midColor().green()), midColor().blue()); + int mid = TQMAX( TQMAX(midColor().red(), midColor().green()), midColor().blue()); // if it's too dark - light instead of dark if (mid < 120) { @@ -1415,9 +1415,9 @@ void Dealer::wheelEvent( TQWheelEvent *e ) e->globalPos(), e->delta(), e->state()); viewportWheelEvent(&ce); if ( !ce.isAccepted() ) { - if ( e->orientation() == Horizontal && hScrollBarMode () == AlwaysOn ) + if ( e->orientation() ==Qt::Horizontal && hScrollBarMode () == AlwaysOn ) TQApplication::sendEvent( horizontalScrollBar(), e); - else if (e->orientation() == Vertical && vScrollBarMode () == AlwaysOn ) + else if (e->orientation() ==Qt::Vertical && vScrollBarMode () == AlwaysOn ) TQApplication::sendEvent( verticalScrollBar(), e); } else { e->accept(); @@ -1430,9 +1430,9 @@ void Dealer::countGame() kdDebug(11111) << "counting game as played." << endl; KConfig *config = kapp->config(); KConfigGroupSaver kcs(config, scores_group); - unsigned int Total = config->readUnsignedNumEntry(TQString("total%1").arg(_id),0); + unsigned int Total = config->readUnsignedNumEntry(TQString("total%1").tqarg(_id),0); ++Total; - config->writeEntry(TQString("total%1").arg(_id),Total); + config->writeEntry(TQString("total%1").tqarg(_id),Total); _gameRecorded = true; } } @@ -1443,12 +1443,12 @@ void Dealer::countLoss() // update score KConfig *config = kapp->config(); KConfigGroupSaver kcs(config, scores_group); - unsigned int n = config->readUnsignedNumEntry(TQString("loosestreak%1").arg(_id),0) + 1; - config->writeEntry(TQString("loosestreak%1").arg(_id),n); - unsigned int m = config->readUnsignedNumEntry(TQString("maxloosestreak%1").arg(_id),0); + unsigned int n = config->readUnsignedNumEntry(TQString("loosestreak%1").tqarg(_id),0) + 1; + config->writeEntry(TQString("loosestreak%1").tqarg(_id),n); + unsigned int m = config->readUnsignedNumEntry(TQString("maxloosestreak%1").tqarg(_id),0); if (n>m) - config->writeEntry(TQString("maxloosestreak%1").arg(_id),n); - config->writeEntry(TQString("winstreak%1").arg(_id),0); + config->writeEntry(TQString("maxloosestreak%1").tqarg(_id),n); + config->writeEntry(TQString("winstreak%1").tqarg(_id),0); } } |