diff options
Diffstat (limited to 'lskat/lskat/lskatview.cpp')
-rw-r--r-- | lskat/lskat/lskatview.cpp | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/lskat/lskat/lskatview.cpp b/lskat/lskat/lskatview.cpp index a338bc00..8603a662 100644 --- a/lskat/lskat/lskatview.cpp +++ b/lskat/lskat/lskatview.cpp @@ -15,7 +15,7 @@ * * ***************************************************************************/ -// include files for Qt +// include files for TQt #include <tqpixmap.h> #include <tqcolor.h> #include <tqrect.h> @@ -104,7 +104,7 @@ #define MOVECOUNTER 20 // so many moves when playing card #define MOVE_TIMER_DELAY 7 // timer in milllisec default 7 -LSkatView::LSkatView(TQWidget *parent, const char *name) : TQWidget(parent, name) +LSkatView::LSkatView(TQWidget *tqparent, const char *name) : TQWidget(tqparent, name) { setBackgroundMode(PaletteBase); // setBackgroundMode(NoBackground); @@ -136,7 +136,7 @@ LSkatView::LSkatView(TQWidget *parent, const char *name) : TQWidget(parent, name // Access the document with the game data LSkatDoc *LSkatView::getDocument() const { - LSkatApp *theApp=(LSkatApp *) parentWidget(); + LSkatApp *theApp=(LSkatApp *) tqparentWidget(); return theApp->getDocument(); } @@ -206,7 +206,7 @@ void LSkatView::drawMove(TQPainter *p) int card; TQPoint point; - card=getDocument()->GetMoveStatus(); + card=getDocument()->GetMovetqStatus(); if (card>=0) { @@ -403,12 +403,12 @@ void LSkatView::drawFinal(TQPainter *p) TQRect brect1_3,brect2_3,brect3_3,brect4_3; TQRect brect1_4,brect2_4,brect3_4,brect4_4; - // Calculate geometry + // Calculate tqgeometry line1=i18n("Game over"); rect=p->window(); //rect1.moveBy(0,FINAL_Y0-24); p->setFont(font24); - brect1=p->boundingRect(rect,Qt::AlignHCenter|Qt::SingleLine|Qt::AlignTop,line1); + brect1=p->boundingRect(rect,TQt::AlignHCenter|TQt::SingleLine|TQt::AlignTop,line1); //TQRect wrect=p->window(); sumrect=brect1; @@ -418,7 +418,7 @@ void LSkatView::drawFinal(TQPainter *p) int hp=getDocument()->mPixTrump[trump].height()+5; rect=TQRect(0,hp>sumrect.height()?hp:sumrect.height(),p->window().width(),p->window().height()); p->setFont(font14); - brect2=p->boundingRect(rect,Qt::AlignHCenter|Qt::SingleLine|Qt::AlignTop,line2); + brect2=p->boundingRect(rect,TQt::AlignHCenter|TQt::SingleLine|TQt::AlignTop,line2); sumrect|=brect2; } else @@ -429,53 +429,53 @@ void LSkatView::drawFinal(TQPainter *p) } else if (sc0>sc1) { - line2=i18n("Player 1 - %1 won ").arg(getDocument()->GetName(0)); + line2=i18n("Player 1 - %1 won ").tqarg(getDocument()->GetName(0)); } else { - line2=i18n("Player 2 - %1 won ").arg(getDocument()->GetName(1)); + line2=i18n("Player 2 - %1 won ").tqarg(getDocument()->GetName(1)); } int hp=getDocument()->mPixTrump[trump].height()+5; rect=TQRect(0,hp>sumrect.height()?hp:sumrect.height(),p->window().width(),p->window().height()); p->setFont(font14); - brect2=p->boundingRect(rect,Qt::AlignHCenter|Qt::SingleLine|Qt::AlignTop,line2); + brect2=p->boundingRect(rect,TQt::AlignHCenter|TQt::SingleLine|TQt::AlignTop,line2); sumrect|=brect2; p->setFont(font14); col1_3=i18n("Score:"); col1_4=TQString(" "); rect=TQRect(0,0,p->window().width(),p->window().height()); - brect1_3=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,col1_3); + brect1_3=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,col1_3); ts[0]=brect1_3.width()+10; col2_3=getDocument()->GetName(0); rect=TQRect(0,0,p->window().width(),p->window().height()); - brect2_3=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,col2_3); + brect2_3=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,col2_3); col2_4=getDocument()->GetName(1); rect=TQRect(0,0,p->window().width(),p->window().height()); - brect2_4=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,col2_4); + brect2_4=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,col2_4); rect=brect2_3|brect2_4; ts[1]=ts[0]+rect.width()+10; col3_3.sprintf("%d",sc0); rect=TQRect(0,0,p->window().width(),p->window().height()); - brect3_3=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,col3_3); + brect3_3=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,col3_3); col3_4.sprintf("%d",sc1); rect=TQRect(0,0,p->window().width(),p->window().height()); - brect3_4=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,col3_4); + brect3_4=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,col3_4); rect=brect3_3|brect3_4; ts[2]=ts[1]+rect.width()+30; - col4_3=i18n("%1 points").arg(pt0); + col4_3=i18n("%1 points").tqarg(pt0); rect=TQRect(0,0,p->window().width(),p->window().height()); - brect4_3=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,col4_3); + brect4_3=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,col4_3); - col4_4=i18n("%1 points").arg(pt1); + col4_4=i18n("%1 points").tqarg(pt1); rect=TQRect(0,0,p->window().width(),p->window().height()); - brect4_4=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,col4_4); + brect4_4=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,col4_4); rect=brect4_3|brect4_4; ts[3]=ts[2]+rect.width()+10; @@ -492,36 +492,36 @@ void LSkatView::drawFinal(TQPainter *p) p->setFont(font14); if (sc0>=120) { - line5=i18n("%1 won to nil. Congratulations!").arg(getDocument()->GetName(0)); + line5=i18n("%1 won to nil. Congratulations!").tqarg(getDocument()->GetName(0)); rect=TQRect(0,sumrect.height()+10,p->window().width(),p->window().height()); - brect5=p->boundingRect(rect,Qt::AlignHCenter|Qt::SingleLine|Qt::AlignTop,line5); + brect5=p->boundingRect(rect,TQt::AlignHCenter|TQt::SingleLine|TQt::AlignTop,line5); sumrect|=brect5; } else if (sc0>=90) { if (sc0==90) - line5=i18n("%1 won with 90 points. Super!").arg(getDocument()->GetName(0)); + line5=i18n("%1 won with 90 points. Super!").tqarg(getDocument()->GetName(0)); else - line5=i18n("%1 won over 90 points. Super!").arg(getDocument()->GetName(0)); + line5=i18n("%1 won over 90 points. Super!").tqarg(getDocument()->GetName(0)); rect=TQRect(0,sumrect.height()+10,p->window().width(),p->window().height()); - brect5=p->boundingRect(rect,Qt::AlignHCenter|Qt::SingleLine|Qt::AlignTop,line5); + brect5=p->boundingRect(rect,TQt::AlignHCenter|TQt::SingleLine|TQt::AlignTop,line5); sumrect|=brect5; } if (sc1>=120) { - line5=i18n("%1 won to nil. Congratulations!").arg(getDocument()->GetName(1)); + line5=i18n("%1 won to nil. Congratulations!").tqarg(getDocument()->GetName(1)); rect=TQRect(0,sumrect.height()+10,p->window().width(),p->window().height()); - brect5=p->boundingRect(rect,Qt::AlignHCenter|Qt::SingleLine|Qt::AlignTop,line5); + brect5=p->boundingRect(rect,TQt::AlignHCenter|TQt::SingleLine|TQt::AlignTop,line5); sumrect|=brect5; } else if (sc1>=90) { if (sc1==90) - line5=i18n("%1 won with 90 points. Super!").arg(getDocument()->GetName(1)); + line5=i18n("%1 won with 90 points. Super!").tqarg(getDocument()->GetName(1)); else - line5=i18n("%1 won over 90 points. Super!").arg(getDocument()->GetName(1)); + line5=i18n("%1 won over 90 points. Super!").tqarg(getDocument()->GetName(1)); rect=TQRect(0,sumrect.height()+10,p->window().width(),p->window().height()); - brect5=p->boundingRect(rect,Qt::AlignHCenter|Qt::SingleLine|Qt::AlignTop,line5); + brect5=p->boundingRect(rect,TQt::AlignHCenter|TQt::SingleLine|TQt::AlignTop,line5); sumrect|=brect5; } } @@ -542,14 +542,14 @@ void LSkatView::drawFinal(TQPainter *p) rect=sumrect; rect.setTop(brect1.top()+offset.y()); //brect1.moveBy(offset.x(),offset.y()); - p->drawText(rect,Qt::AlignHCenter|Qt::SingleLine|Qt::AlignTop,line1); + p->drawText(rect,TQt::AlignHCenter|TQt::SingleLine|TQt::AlignTop,line1); p->setFont(font14); p->setPen(COL_PLAYER); rect=sumrect; rect.setTop(brect2.top()+offset.y()); //brect2.moveBy(offset.x(),offset.y()); - p->drawText(rect,Qt::AlignHCenter|Qt::SingleLine|Qt::AlignTop,line2); + p->drawText(rect,TQt::AlignHCenter|TQt::SingleLine|TQt::AlignTop,line2); p->drawPixmap(sumrect.topLeft()+TQPoint(-5,-5), getDocument()->mPixTrump[trump]); p->drawPixmap(sumrect.topLeft()+TQPoint(5,-5)+TQPoint(sumrect.width()-getDocument()->mPixTrump[trump].width(),0), @@ -560,40 +560,40 @@ void LSkatView::drawFinal(TQPainter *p) { p->setTabArray(ts); p->setFont(font14); - p->setPen(Qt::black); + p->setPen(TQt::black); rect=sumrect; rect.setTop(brect3.top()+offset.y()); // Workaround for the next line where the ExpandTab crashes!!! drawTabText(p,rect,line3,ts); - // p->drawText(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop|Qt::ExpandTabs,line3); + // p->drawText(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop|TQt::ExpandTabs,line3); rect=sumrect; rect.setTop(brect4.top()+offset.y()); // Workaround for the next line where the ExpandTab crashes!!! drawTabText(p,rect,line4,ts); - // p->drawText(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop|Qt::ExpandTabs,line4); + // p->drawText(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop|TQt::ExpandTabs,line4); } if (!line5.isNull()) { p->setFont(font14); - p->setPen(Qt::black); + p->setPen(TQt::black); rect=sumrect; rect.setTop(brect5.top()+offset.y()); - p->drawText(rect,Qt::AlignHCenter|Qt::SingleLine|Qt::AlignTop,line5); + p->drawText(rect,TQt::AlignHCenter|TQt::SingleLine|TQt::AlignTop,line5); } } // This function is just a workaround for the QT function drawText -// with Qt::EXpandTAbs eanbled. For some strange reasons this crashes... +// with TQt::EXpandTAbs eanbled. For some strange reasons this crashes... void LSkatView::drawTabText(TQPainter *p,TQRect rect,TQString s,int *ts) { int lcnt=0; - // p->setPen(Qt::black); + // p->setPen(TQt::black); // p->drawRect(rect); while(s.length()>0 && (lcnt==0 || ts[lcnt-1]) ) { - int lpos=s.find("\t"); + int lpos=s.tqfind("\t"); int rpos=s.length()-lpos-1; if (lpos<0) { @@ -605,13 +605,13 @@ void LSkatView::drawTabText(TQPainter *p,TQRect rect,TQString s,int *ts) TQRect rect2=rect; if (lcnt>0) rect2.setLeft(rect.left()+ts[lcnt-1]); - p->drawText(rect2,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,tmp); + p->drawText(rect2,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,tmp); lcnt++; } } // Draw the status field at the right side -void LSkatView::drawStatus(TQPainter *p) +void LSkatView::drawtqStatus(TQPainter *p) { TQPoint p1,p2; int trump; @@ -651,7 +651,7 @@ void LSkatView::drawStatus(TQPainter *p) // Player pl ------------------- // line1=TQString(i18n("Player 1"))+TQString(TQCString(" - "))+getDocument()->GetName(0); line1=getDocument()->GetName(pl); - brect1=p->boundingRect(drawrect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line1); + brect1=p->boundingRect(drawrect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line1); sumrect=brect1; if (getDocument()->IsRunning()) @@ -659,11 +659,11 @@ void LSkatView::drawStatus(TQPainter *p) // Geometry and strings line2=i18n("Score:"); rect=TQRect(drawrect.left(),sumrect.bottom()+16,drawrect.width(),drawrect.height()-sumrect.height()); - brect2=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line2); + brect2=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line2); sumrect|=brect2; line3=i18n("Move:"); rect=TQRect(drawrect.left(),sumrect.bottom()+10,drawrect.width(),drawrect.height()-sumrect.height()); - brect3=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line3); + brect3=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line3); sumrect|=brect3; rect=brect2|brect3; @@ -674,14 +674,14 @@ void LSkatView::drawStatus(TQPainter *p) // paint if (getDocument()->GetStartPlayer()==pl) p->setPen(COL_PLAYER); else p->setPen(black); - p->drawText(brect1,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line1); + p->drawText(brect1,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line1); p->setPen(black); - p->drawText(brect2,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line2); - p->drawText(brect3,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line3); + p->drawText(brect2,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line2); + p->drawText(brect3,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line3); rect2=TQRect(brect2.left()+rect.width(),brect2.top(),drawrect.width()-brect2.width()-rect.width(),brect2.height()); - p->drawText(rect2,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line2a); + p->drawText(rect2,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line2a); rect2=TQRect(brect3.left()+rect.width(),brect3.top(),drawrect.width()-brect3.width()-rect.width(),brect3.height()); - p->drawText(rect2,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line2b); + p->drawText(rect2,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line2b); pa=TQPoint(drawrect.width()-getDocument()->mPixTrump[trump].width(),drawrect.height()-getDocument()->mPixTrump[trump].height()); if (getDocument()->GetStartPlayer()==pl) @@ -695,17 +695,17 @@ void LSkatView::drawStatus(TQPainter *p) // Geometry and strings line2=i18n("Points:"); rect=TQRect(drawrect.left(),sumrect.bottom()+6,drawrect.width(),drawrect.height()-sumrect.height()); - brect2=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line2); + brect2=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line2); sumrect|=brect2; line3=i18n("Won:"); rect=TQRect(drawrect.left(),sumrect.bottom()+6,drawrect.width(),drawrect.height()-sumrect.height()); - brect3=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line3); + brect3=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line3); sumrect|=brect3; line4=i18n("Games:"); rect=TQRect(drawrect.left(),sumrect.bottom()+6,drawrect.width(),drawrect.height()-sumrect.height()); - brect4=p->boundingRect(rect,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line4); + brect4=p->boundingRect(rect,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line4); sumrect|=brect4; rect=brect2|brect3|brect4; @@ -716,17 +716,17 @@ void LSkatView::drawStatus(TQPainter *p) // paint p->setPen(COL_PLAYER); - p->drawText(brect1,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line1); + p->drawText(brect1,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line1); p->setPen(black); - p->drawText(brect2,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line2); - p->drawText(brect3,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line3); - p->drawText(brect4,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line4); + p->drawText(brect2,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line2); + p->drawText(brect3,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line3); + p->drawText(brect4,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line4); rect2=TQRect(brect2.left()+rect.width(),brect2.top(),drawrect.width()-brect2.width()-rect.width()+5,brect2.height()); - p->drawText(rect2,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line2a); + p->drawText(rect2,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line2a); rect2=TQRect(brect3.left()+rect.width(),brect3.top(),drawrect.width()-brect3.width()-rect.width()+5,brect3.height()); - p->drawText(rect2,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line2b); + p->drawText(rect2,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line2b); rect2=TQRect(brect4.left()+rect.width(),brect4.top(),drawrect.width()-brect4.width()-rect.width()+5,brect4.height()); - p->drawText(rect2,Qt::AlignLeft|Qt::SingleLine|Qt::AlignTop,line2c); + p->drawText(rect2,TQt::AlignLeft|TQt::SingleLine|TQt::AlignTop,line2c); pa=TQPoint(drawrect.width()-getDocument()->mPixType[getDocument()->GetPlayedBy(pl)-1].width(),0); p->drawPixmap(p1+pa+TQPoint(3,-3), getDocument()->mPixType[getDocument()->GetPlayedBy(pl)-1]); @@ -740,7 +740,7 @@ void LSkatView::drawStatus(TQPainter *p) void LSkatView::Paint(TQPainter *p) { // If game is running - drawStatus(p); + drawtqStatus(p); drawDeck(p); if (getDocument()->IsRunning()) { @@ -760,7 +760,7 @@ void LSkatView::paintEvent( TQPaintEvent * e) TQPixmap pm(this->rect().size()); TQPainter p; TQBrush brush; - p.begin(&pm,this); + p.tqbegin(TQT_TQPAINTDEVICE(&pm),this); brush.setPixmap( getDocument()->mPixBackground ); p.fillRect(0,0,this->rect().width(),this->rect().height(),brush); drawIntro(&p); @@ -790,10 +790,10 @@ TQPoint LSkatView::calcCardPos(int x,int y) // mouse click event void LSkatView::mousePressEvent( TQMouseEvent *mouse ) { - if (mouse->button()!=LeftButton) return ; + if (mouse->button()!=Qt::LeftButton) return ; if (!getDocument()->IsRunning()) return ; - if (getDocument()->GetMoveStatus()!=-1) return ; + if (getDocument()->GetMovetqStatus()!=-1) return ; TQPoint point; int mx,my,player; @@ -890,7 +890,7 @@ void LSkatView::introTimerReady() } else if (introcnt<NO_OF_CARDS) { - repaint(false); + tqrepaint(false); } } @@ -900,7 +900,7 @@ void LSkatView::moveTimerReady() TQString ld,s; if (cardmovecnt>=MOVECOUNTER) { - LSkatApp *m=(LSkatApp *) parentWidget(); + LSkatApp *m=(LSkatApp *) tqparentWidget(); moveTimer->stop(); cardmovecnt=0; update(TQRect(cardend,getDocument()->cardsize)); @@ -925,7 +925,7 @@ void LSkatView::moveTimerReady() } } -void LSkatView::updateStatus() +void LSkatView::updatetqStatus() { update(status_rect1); update(status_rect2); |