[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeedu/khangman/khangman
From:       Anne-Marie Mahfouf <annma () kde ! org>
Date:       2005-04-25 20:02:47
Message-ID: 20050425200247.A6716488 () office ! kde ! org
[Download RAW message or body]

CVS commit by annma: 

center word better in both themes


  M +29 -23    khangmanview.cpp   1.123


--- kdeedu/khangman/khangman/khangmanview.cpp  #1.122:1.123
@@ -181,5 +181,4 @@ void KHangManView::setTheme()
     loadAnimation();
     slotSetPixmap(bcgdPicture); 
-    paintMisses();   
     update();
 }
@@ -196,10 +195,18 @@ void KHangManView::paintWord()
     QPainter paint;
     paint.begin(&bg);
-    //if (Prefs::mode() ==0)  {
-    QRect myRect = QRect(0, height()-height()*126/535, width()*366/700, \
height()*126/535); +    kdDebug() << "width() " << width() << endl;
+    QRect myRect;
+    if (Prefs::mode() ==0)   //sea
+        myRect = QRect(0, height()-height()*126/535, width()*417/700, \
height()*126/535); +    else  
+        myRect = QRect(0, height()-height()*126/535, width()*327/700, \
height()*126/535);  QPixmap pix( myRect.size() );
     pix.fill( this, myRect.topLeft() );
     QPainter p(&pix);
     QFont tFont;
+    if (Prefs::mode() ==0)   //sea
+        p.setPen( QColor(148, 156, 167));
+    else  
+        p.setPen( QColor(87, 0, 0));
     if (Prefs::selectedLanguage() =="tg")  {
         tFont.setFamily( "URW Bookman" );
@@ -209,9 +216,8 @@ void KHangManView::paintWord()
     tFont.setPixelSize( 28 ); //this has to be scaled depending of the dpi
     p.setFont(tFont);
-    if (Prefs::mode() ==0)   //sea
-        p.setPen( QColor(148, 156, 167));
+    if (Prefs::mode() ==0)
+        p.drawText(0,0, width()*417/700, height()*126/535, AlignCenter|AlignCenter, \
goodWord);  else
-        p.setPen( QColor(87, 0, 0));
-    p.drawText(0,0, width()*366/700, height()*126/535, AlignCenter|AlignCenter, \
goodWord); +        p.drawText(0,0, width()*327/700, height()*126/535, \
AlignCenter|AlignCenter, goodWord);  p.end();
     paint.drawPixmap(myRect,pix);
@@ -222,23 +228,23 @@ void KHangManView::paintWordTwice()
 {
     /*QPainter paint;
-    paint.begin(paletteBackgroundPixmap());
-    paint.setFont(QFont("Arial", 30));
-    paint.setPen(QColor(Qt::red));
+    paint.begin(&bg);
     QRect myRect = QRect(0, height()-height()*126/535, width()*366/700, \
height()*126/535); +    QFont tFont;
+    if (Prefs::selectedLanguage() =="tg")  {
+        tFont.setFamily( "URW Bookman" );
+    }
+    else
+        tFont.setFamily( "Arial" );
+    tFont.setPixelSize( 28 ); //this has to be scaled depending of the dpi
+    paint.setFont(tFont);
+    paint.setPen(QColor(Qt::red));
     QRect aux = paint.boundingRect(myRect, AlignCenter|AlignCenter, \
                goodWord.left(redIndex));
-    if (Prefs::mode() ==0) { //sea theme
+    kdDebug() << aux.width() << endl;
         if (redIndex == 0)
-            paint.drawText(+4,height()-height()*126/535, width()*366/700/2, \
height()*126/535, AlignCenter|AlignCenter, QString(goodWord[redIndex])); +        \
paint.drawText(aux.width()+2, height()-height()*126/535, width()*366/700, \
height()*126/535, AlignCenter|AlignCenter, QString(goodWord[redIndex]));  else \
                //weird that it needs 2 pixels less after first
             paint.drawText(aux.width()+2, height()-height()*126/535, \
width()*366/700/2, height()*126/535, AlignCenter|AlignCenter, \
                QString(goodWord[redIndex]));
-    }
-    else { //desert theme
-        if (redIndex == 0)
-            paint.drawText(width()*325/700+aux.width(), height()-height()*86/535,  \
width()*325/700, height()*86/535, AlignCenter|AlignCenter, \
                QString(goodWord[redIndex]));
-        else 
-            paint.drawText(width()*325/700+aux.width(), height()-height()*86/535,  \
width()*325/700, height()*86/535, AlignCenter|AlignCenter, \
                QString(goodWord[redIndex]));
-    }
     paint.end();
-    bitBlt(this, 0, 0, paletteBackgroundPixmap());*/
+    bitBlt(this, 0, 0, &bg);*/
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic